Alexander Pyhalov
2014-06-03 5b32294b234fc458d5c2b191b507ab602273e72a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
This patch ensures that 64-bit shared objects are in a subdirectory named
"64".  Note that changes to the Lib/distutils/tests/test_build.py and
Lib/distutils/tests/test_install.py avoid running tests that fail due to
this patch.  As this is Solaris-specific, it is not suitable for upstream.
 
--- Python-3.4.0/Lib/distutils/command/build_ext.py.~1~    2014-03-16 19:31:29.000000000 -0700
+++ Python-3.4.0/Lib/distutils/command/build_ext.py    2014-03-17 13:18:10.057787061 -0700
@@ -668,7 +668,12 @@
         ext_suffix = get_config_var('EXT_SUFFIX')
         if os.name == 'nt' and self.debug:
             return os.path.join(*ext_path) + '_d' + ext_suffix
-        return os.path.join(*ext_path) + ext_suffix
+        #return os.path.join(*ext_path) + ext_suffix
+        path = os.path.join (ext_path)
+        if sys.maxsize == 2147483647:
+            return os.path.join(*ext_path) + ext_suffix
+        (dirname, basename) = os.path.split(os.path.join(*ext_path));
+        return os.path.join(dirname, "64", basename + ext_suffix)
 
     def get_export_symbols(self, ext):
         """Return the list of symbols that a shared extension has to
--- Python-3.4.0/Lib/distutils/tests/test_build_ext.py.~1~    2014-03-16 19:31:29.000000000 -0700
+++ Python-3.4.0/Lib/distutils/tests/test_build_ext.py    2014-03-17 13:18:10.098081226 -0700
@@ -317,7 +317,7 @@
         ext_suffix = sysconfig.get_config_var('EXT_SUFFIX')
         self.assertTrue(so_file.endswith(ext_suffix))
         so_dir = os.path.dirname(so_file)
-        self.assertEqual(so_dir, other_tmp_dir)
+        #self.assertEqual(so_dir, other_tmp_dir)
 
         cmd.inplace = 0
         cmd.compiler = None
@@ -364,7 +364,7 @@
         curdir = os.getcwd()
         wanted = os.path.join(curdir, 'src', 'lxml', 'etree' + ext)
         path = cmd.get_ext_fullpath('lxml.etree')
-        self.assertEqual(wanted, path)
+        #self.assertEqual(wanted, path)
 
         # building lxml.etree not inplace
         cmd.inplace = 0
--- Python-3.4.0/Lib/sysconfig.py.~1~    2014-03-16 19:31:30.000000000 -0700
+++ Python-3.4.0/Lib/sysconfig.py    2014-03-17 13:18:10.099539252 -0700
@@ -392,7 +392,11 @@
     if hasattr(sys, "gettotalrefcount"):
         pybuilddir += '-pydebug'
     os.makedirs(pybuilddir, exist_ok=True)
-    destfile = os.path.join(pybuilddir, name + '.py')
+    if sys.maxsize == 2147483647:
+        destfile = os.path.join(pybuilddir, name + '.py')
+    else:
+        os.makedirs(pybuilddir + '/64', exist_ok=True)
+        destfile = os.path.join(pybuilddir + '/64', name + '.py')
 
     with open(destfile, 'w', encoding='utf8') as f:
         f.write('# system configuration generated and used by'
--- Python-3.4.0/Modules/getpath.c.~1~    2014-03-16 19:31:31.000000000 -0700
+++ Python-3.4.0/Modules/getpath.c    2014-04-25 15:02:02.837613851 -0700
@@ -697,6 +697,10 @@
         wcsncpy(exec_prefix, _exec_prefix, MAXPATHLEN);
         joinpath(exec_prefix, L"lib/lib-dynload");
     }
+    if (sizeof(void *) == 8 && wcslen(exec_prefix) + 3 <= MAXPATHLEN) {
+        wcscat(exec_prefix, L"/64");
+    }
+
     /* If we found EXEC_PREFIX do *not* reduce it!  (Yet.) */
 
     if ((!pfound || !efound) && !Py_FrozenFlag)
@@ -710,8 +714,30 @@
     if (_rtpypath && _rtpypath[0] != '\0') {
         size_t rtpypath_len;
         rtpypath = _Py_char2wchar(_rtpypath, &rtpypath_len);
-        if (rtpypath != NULL)
-            bufsz += rtpypath_len + 1;
+        if (rtpypath != NULL) {
+            wchar_t *orig_rtpypath = rtpypath;
+
+            /*
+             * Split the path; for each component, add that component + "/64"
+             * (if in 64-bit mode) and the component unadorned (regardless).
+             */
+            while (1) {
+                wchar_t *delim = wcschr(rtpypath, DELIM);
+                if (delim) {
+                    /* once for usual, another for usual + "/64" */
+                    bufsz += delim - rtpypath + 1;
+                    if (sizeof(void *) == 8)
+                        bufsz += delim - rtpypath + 1 + 3;
+                } else {
+                    bufsz += wcslen(rtpypath) + 1;
+                    if (sizeof(void *) == 8)
+                        bufsz += wcslen(rtpypath) + 1 + 3;
+                    break;
+                }
+                rtpypath = delim + 1;
+            }
+            rtpypath = orig_rtpypath;
+        }
     }
 
     defpath = _pythonpath;
@@ -723,9 +749,19 @@
             /* Paths are relative to prefix */
             bufsz += prefixsz;
 
-        if (delim)
+        if (delim) {
+            if (sizeof(void *) == 8) {
+                bufsz += delim - defpath + 1 + 3;
+                if (defpath[0] != SEP)
+                    bufsz += prefixsz;
+            }
             bufsz += delim - defpath + 1;
-        else {
+        } else {
+            if (sizeof(void *) == 8) {
+                bufsz += wcslen(defpath) + 1 + 3;
+                if (defpath[0] != SEP)
+                    bufsz += prefixsz;
+            }
             bufsz += wcslen(defpath) + 1;
             break;
         }
@@ -741,13 +777,38 @@
             "Not enough memory for dynamic PYTHONPATH");
     }
 
+    buf[0] = '\0';
     /* Run-time value of $PYTHONPATH goes first */
     if (rtpypath) {
-        wcscpy(buf, rtpypath);
-        wcscat(buf, delimiter);
+        wchar_t *orig_rtpypath = rtpypath;
+
+        while (1) {
+            wchar_t *delim = wcschr(rtpypath, DELIM);
+
+            if (delim) {
+                *delim = '\0';
+                if (sizeof(void *) == 8) {
+                    wcscat(buf, rtpypath);
+                    wcscat(buf, L"/64");
+                    wcscat(buf, delimiter);
+                }
+                wcscat(buf, rtpypath);
+                wcscat(buf, delimiter);
+                *delim = DELIM;
+            } else {
+                if (sizeof(void *) == 8) {
+                    wcscat(buf, rtpypath);
+                    wcscat(buf, L"/64");
+                    wcscat(buf, delimiter);
+                }
+                wcscat(buf, rtpypath);
+                wcscat(buf, delimiter);
+                break;
+            }
+            rtpypath = delim + 1;
+        }
+        rtpypath = orig_rtpypath;
     }
-    else
-        buf[0] = '\0';
 
     /* Next is the default zip path */
     wcscat(buf, zip_path);
@@ -766,18 +827,35 @@
         }
 
         if (delim) {
-            size_t len = delim - defpath + 1;
-            size_t end = wcslen(buf) + len;
-            wcsncat(buf, defpath, len);
-            *(buf + end) = '\0';
-        }
-        else {
+            *delim = '\0';
+            if (sizeof(void *) == 8) {
+                wcscat(buf, defpath);
+                wcscat(buf, L"/64");
+                wcscat(buf, delimiter);
+                if (defpath[0] != SEP) {
+                    wcscat(buf, prefix);
+                    wcscat(buf, separator);
+                }
+            }
             wcscat(buf, defpath);
+            wcscat(buf, delimiter);
+            *delim = DELIM;
+        } else {
+            if (sizeof(void *) == 8) {
+                wcscat(buf, defpath);
+                wcscat(buf, L"/64");
+                wcscat(buf, delimiter);
+                if (defpath[0] != SEP) {
+                    wcscat(buf, prefix);
+                    wcscat(buf, separator);
+                }
+            }
+            wcscat(buf, defpath);
+            wcscat(buf, delimiter);
             break;
         }
         defpath = delim + 1;
     }
-    wcscat(buf, delimiter);
 
     /* Finally, on goes the directory for dynamic-load modules */
     wcscat(buf, exec_prefix);