1 --- Python-2.7.6/Lib/distutils/command/build_ext.py.~1~ 2013-11-09 23:36:40.000000000 -0800
2 +++ Python-2.7.6/Lib/distutils/command/build_ext.py 2014-05-14 12:47:04.342901439 -0700
4 filename = self.get_ext_filename(ext_name)
5 filename = os.path.split(filename)[-1]
7 + # on Solaris we put 64-bit python objects under .../64
8 + if sys.maxint != 2147483647L:
9 + filename = os.path.join("64", filename)
12 # no further work needed
15 so_ext = get_config_var('SO')
16 if os.name == 'nt' and self.debug:
17 return os.path.join(*ext_path) + '_d' + so_ext
18 - return os.path.join(*ext_path) + so_ext
19 + #return os.path.join(*ext_path) + so_ext
20 + # .so extensions are word-size specific
21 + path = apply(os.path.join, ext_path)
22 + if sys.maxint == 2147483647L:
23 + return path + so_ext
24 + dirname = os.path.dirname(path);
25 + basename = os.path.basename(path);
26 + return os.path.join(dirname, "64", basename + so_ext)
28 def get_export_symbols (self, ext):
29 """Return the list of symbols that a shared extension has to
30 --- Python-2.7.6/Python/import.c.~1~ 2013-11-09 23:36:41.000000000 -0800
31 +++ Python-2.7.6/Python/import.c 2014-05-14 12:53:34.233016586 -0700
32 @@ -1288,6 +1288,57 @@
33 static int find_init_module(char *); /* Forward */
34 static struct filedescr importhookdescr = {"", "", IMP_HOOK};
38 +insert_64dir(char *buf, size_t buflen)
44 + if ((blen = strlen(buf)) == 0)
47 + cp = &buf[blen - 1];
48 + while (cp != buf && *cp != SEP)
54 + if (blen + strlen("64/") + 1 >= buflen)
58 + sprintf(cp, "64%c%s", SEP, base);
65 + * If we're on a 64-bit platform, modify lookups for shared object files.
67 +static size_t modify_path(struct filedescr *fdp, char *buf, size_t buflen)
69 + struct stat statbuf;
71 + if (sizeof(void *) != 8)
74 + if (stat(buf, &statbuf) == 0 && S_ISDIR(statbuf.st_mode))
77 + if (fdp->type != C_EXTENSION)
80 + if (insert_64dir(buf, buflen) == NULL)
83 + return strlen("64/");
87 static struct filedescr *
88 find_module(char *fullname, char *subname, PyObject *path, char *buf,
89 size_t buflen, FILE **p_fp, PyObject **p_loader)
90 @@ -1302,11 +1353,10 @@
91 static struct filedescr fd_builtin = {"", "", C_BUILTIN};
92 static struct filedescr fd_package = {"", "", PKG_DIRECTORY};
94 -#if defined(PYOS_OS2)
97 char *saved_buf = NULL;
100 if (p_loader != NULL)
103 @@ -1513,15 +1563,17 @@
107 -#if defined(PYOS_OS2)
108 /* take a snapshot of the module spec for restoration
109 * after the 8 character DLL hackery
111 saved_buf = strdup(buf);
113 saved_namelen = namelen;
114 -#endif /* PYOS_OS2 */
116 for (fdp = _PyImport_Filetab; fdp->suffix != NULL; fdp++) {
118 + len += modify_path(fdp, buf, buflen);
120 #if defined(PYOS_OS2) && defined(HAVE_DYNAMIC_LOADING)
121 /* OS/2 limits DLLs to 8 character names (w/o
123 @@ -1562,21 +1614,20 @@
127 -#if defined(PYOS_OS2)
129 /* restore the saved snapshot */
130 strcpy(buf, saved_buf);
132 namelen = saved_namelen;
135 -#if defined(PYOS_OS2)
137 /* don't need/want the module name snapshot anymore */
148 --- Python-2.7.1/Python/importdl.h.orig Fri Jul 15 15:48:16 2011
149 +++ Python-2.7.1/Python/importdl.h Fri Jul 15 15:49:10 2011
151 extern PyObject *_PyImport_LoadDynamicModule(char *name, char *pathname,
154 -/* Max length of module suffix searched for -- accommodates "module.slb" */
155 -#define MAXSUFFIXSIZE 12
156 +/* Max length of module suffix searched for -- accommodates "module.slb"
158 +#define MAXSUFFIXSIZE 15
162 --- Python-2.7.15/Lib/distutils/tests/test_build_ext.py.~1~ 2018-04-30 01:47:33.000000000 +0000
163 +++ Python-2.7.15/Lib/distutils/tests/test_build_ext.py 2018-08-27 17:45:37.658024420 +0000
165 self.assertEqual(os.path.splitext(so_file)[-1],
166 sysconfig.get_config_var('SO'))
167 so_dir = os.path.dirname(so_file)
168 - self.assertEqual(so_dir, other_tmp_dir)
169 + if sys.platform != 'sunos5':
170 + self.assertEqual(so_dir, other_tmp_dir)
175 self.assertEqual(os.path.splitext(so_file)[-1],
176 sysconfig.get_config_var('SO'))
177 so_dir = os.path.dirname(so_file)
178 - self.assertEqual(so_dir, cmd.build_lib)
179 + if sys.platform != 'sunos5':
180 + self.assertEqual(so_dir, cmd.build_lib)
182 # inplace = 0, cmd.package = 'bar'
183 build_py = cmd.get_finalized_command('build_py')
185 path = cmd.get_ext_fullpath('foo')
186 # checking that the last directory is the build_dir
187 path = os.path.split(path)[0]
188 - self.assertEqual(path, cmd.build_lib)
189 + if sys.platform != 'sunos5':
190 + self.assertEqual(path, cmd.build_lib)
192 # inplace = 1, cmd.package = 'bar'
195 # checking that the last directory is bar
196 path = os.path.split(path)[0]
197 lastdir = os.path.split(path)[-1]
198 - self.assertEqual(lastdir, 'bar')
199 + if sys.platform != 'sunos5':
200 + self.assertEqual(lastdir, 'bar')
202 def test_ext_fullpath(self):
203 ext = sysconfig.get_config_vars()['SO']
204 @@ -341,14 +345,16 @@
206 wanted = os.path.join(curdir, 'src', 'lxml', 'etree' + ext)
207 path = cmd.get_ext_fullpath('lxml.etree')
208 - self.assertEqual(wanted, path)
209 + if sys.platform != 'sunos5':
210 + self.assertEqual(wanted, path)
212 # building lxml.etree not inplace
214 cmd.build_lib = os.path.join(curdir, 'tmpdir')
215 wanted = os.path.join(curdir, 'tmpdir', 'lxml', 'etree' + ext)
216 path = cmd.get_ext_fullpath('lxml.etree')
217 - self.assertEqual(wanted, path)
218 + if sys.platform != 'sunos5':
219 + self.assertEqual(wanted, path)
221 # building twisted.runner.portmap not inplace
222 build_py = cmd.get_finalized_command('build_py')
223 @@ -357,13 +363,15 @@
224 path = cmd.get_ext_fullpath('twisted.runner.portmap')
225 wanted = os.path.join(curdir, 'tmpdir', 'twisted', 'runner',
227 - self.assertEqual(wanted, path)
228 + if sys.platform != 'sunos5':
229 + self.assertEqual(wanted, path)
231 # building twisted.runner.portmap inplace
233 path = cmd.get_ext_fullpath('twisted.runner.portmap')
234 wanted = os.path.join(curdir, 'twisted', 'runner', 'portmap' + ext)
235 - self.assertEqual(wanted, path)
236 + if sys.platform != 'sunos5':
237 + self.assertEqual(wanted, path)
239 def test_build_ext_inplace(self):
240 etree_c = os.path.join(self.tmp_dir, 'lxml.etree.c')
242 ext = sysconfig.get_config_var("SO")
243 wanted = os.path.join(curdir, 'src', 'lxml', 'etree' + ext)
244 path = cmd.get_ext_fullpath('lxml.etree')
245 - self.assertEqual(wanted, path)
246 + if sys.platform != 'sunos5':
247 + self.assertEqual(wanted, path)
249 def test_setuptools_compat(self):
250 import distutils.core, distutils.extension, distutils.command.build_ext
252 ext_name = os.path.join('UpdateManager', 'fdsend')
253 ext_path = cmd.get_ext_fullpath(ext_name)
254 wanted = os.path.join(cmd.build_lib, 'UpdateManager', 'fdsend' + ext)
255 - self.assertEqual(ext_path, wanted)
256 + if sys.platform != 'sunos5':
257 + self.assertEqual(ext_path, wanted)
259 @unittest.skipUnless(sys.platform == 'win32', 'these tests require Windows')
260 def test_build_ext_path_cross_platform(self):