1 diff -durN -x '*~' -x '*.orig' Python-2.7.10.orig/Include/pythonrun.h Python-2.7.10/Include/pythonrun.h
2 --- Python-2.7.10.orig/Include/pythonrun.h 2015-05-23 18:09:00.000000000 +0200
3 +++ Python-2.7.10/Include/pythonrun.h 2015-12-02 17:54:33.560101256 +0100
5 /* In their own files */
6 PyAPI_FUNC(const char *) Py_GetVersion(void);
7 PyAPI_FUNC(const char *) Py_GetPlatform(void);
8 +PyAPI_FUNC(const char *) Py_GetArch(void);
9 +PyAPI_FUNC(const char *) Py_GetLib(void);
10 PyAPI_FUNC(const char *) Py_GetCopyright(void);
11 PyAPI_FUNC(const char *) Py_GetCompiler(void);
12 PyAPI_FUNC(const char *) Py_GetBuildInfo(void);
13 diff -durN -x '*~' -x '*.orig' Python-2.7.10.orig/Lib/distutils/command/install.py Python-2.7.10/Lib/distutils/command/install.py
14 --- Python-2.7.10.orig/Lib/distutils/command/install.py 2015-05-23 18:09:01.000000000 +0200
15 +++ Python-2.7.10/Lib/distutils/command/install.py 2015-12-02 17:54:33.560101256 +0100
17 from site import USER_SITE
22 if sys.version < "2.2":
29 - 'purelib': '$base/lib/python$py_version_short/site-packages',
30 - 'platlib': '$platbase/lib/python$py_version_short/site-packages',
31 + 'purelib': '$base/'+libname+'/python$py_version_short/site-packages',
32 + 'platlib': '$platbase/'+libname+'/python$py_version_short/site-packages',
33 'headers': '$base/include/python$py_version_short/$dist_name',
34 'scripts': '$base/bin',
38 - 'purelib': '$base/lib/python',
39 - 'platlib': '$base/lib/python',
40 + 'purelib': '$base/'+libname+'/python',
41 + 'platlib': '$base/'+libname+'/python',
42 'headers': '$base/include/python/$dist_name',
43 'scripts': '$base/bin',
45 diff -durN -x '*~' -x '*.orig' Python-2.7.10.orig/Lib/distutils/sysconfig.py Python-2.7.10/Lib/distutils/sysconfig.py
46 --- Python-2.7.10.orig/Lib/distutils/sysconfig.py 2015-05-23 18:09:02.000000000 +0200
47 +++ Python-2.7.10/Lib/distutils/sysconfig.py 2015-12-02 17:57:40.004593153 +0100
49 prefix = plat_specific and EXEC_PREFIX or PREFIX
51 if os.name == "posix":
52 - libpython = os.path.join(prefix,
53 - "lib", "python" + get_python_version())
54 + if plat_specific or standard_lib or prefix != "/usr":
55 + libpython = os.path.join(prefix,
56 + sys.lib, "python" + get_python_version())
58 + libpython = os.path.join(prefix,
59 + "share", "python" + get_python_version())
63 diff -durN -x '*~' -x '*.orig' Python-2.7.10.orig/Lib/distutils/tests/test_install.py Python-2.7.10/Lib/distutils/tests/test_install.py
64 --- Python-2.7.10.orig/Lib/distutils/tests/test_install.py 2015-05-23 18:09:02.000000000 +0200
65 +++ Python-2.7.10/Lib/distutils/tests/test_install.py 2015-12-02 17:54:33.560101256 +0100
67 expected = os.path.normpath(expected)
68 self.assertEqual(got, expected)
70 - libdir = os.path.join(destination, "lib", "python")
71 + libdir = os.path.join(destination, sys.lib, "python")
72 check_path(cmd.install_lib, libdir)
73 check_path(cmd.install_platlib, libdir)
74 check_path(cmd.install_purelib, libdir)
75 diff -durN -x '*~' -x '*.orig' Python-2.7.10.orig/Lib/site.py Python-2.7.10/Lib/site.py
76 --- Python-2.7.10.orig/Lib/site.py 2015-05-23 18:09:06.000000000 +0200
77 +++ Python-2.7.10/Lib/site.py 2015-12-02 17:59:13.041917804 +0100
79 if sys.platform in ('os2emx', 'riscos'):
80 sitepackages.append(os.path.join(prefix, "Lib", "site-packages"))
82 - sitepackages.append(os.path.join(prefix, "lib",
83 + sitepackages.append(os.path.join(prefix, sys.lib,
84 "python" + sys.version[:3],
86 - sitepackages.append(os.path.join(prefix, "lib", "site-python"))
87 + sitepackages.append(os.path.join(prefix, sys.lib, "site-python"))
88 + sitepackages.append(os.path.join(prefix, "share",
89 + "python" + sys.version[:3],
91 + sitepackages.append(os.path.join(prefix, "share", "site-python"))
93 sitepackages.append(prefix)
94 - sitepackages.append(os.path.join(prefix, "lib", "site-packages"))
95 + sitepackages.append(os.path.join(prefix, sys.lib, "site-packages"))
96 if sys.platform == "darwin":
97 # for framework builds *only* we add the standard Apple
99 diff -durN -x '*~' -x '*.orig' Python-2.7.10.orig/Lib/sysconfig.py Python-2.7.10/Lib/sysconfig.py
100 --- Python-2.7.10.orig/Lib/sysconfig.py 2015-05-23 18:09:07.000000000 +0200
101 +++ Python-2.7.10/Lib/sysconfig.py 2015-12-02 17:54:33.563434609 +0100
104 from os.path import pardir, realpath
110 - 'stdlib': '{base}/lib/python{py_version_short}',
111 - 'platstdlib': '{platbase}/lib/python{py_version_short}',
112 - 'purelib': '{base}/lib/python{py_version_short}/site-packages',
113 - 'platlib': '{platbase}/lib/python{py_version_short}/site-packages',
114 + 'stdlib': '{base}/' + libname + '/python{py_version_short}',
115 + 'platstdlib': '{platbase}/' + libname + '/python{py_version_short}',
116 + 'purelib': '{base}/' + libname + '/python{py_version_short}/site-packages',
117 + 'platlib': '{platbase}/' + libname + '/python{py_version_short}/site-packages',
118 'include': '{base}/include/python{py_version_short}',
119 'platinclude': '{platbase}/include/python{py_version_short}',
120 'scripts': '{base}/bin',
124 - 'stdlib': '{base}/lib/python',
125 - 'platstdlib': '{base}/lib/python',
126 - 'purelib': '{base}/lib/python',
127 - 'platlib': '{base}/lib/python',
128 + 'stdlib': '{base}/' + libname + '/python',
129 + 'platstdlib': '{base}/' + libname + '/python',
130 + 'purelib': '{base}/' + libname + '/python',
131 + 'platlib': '{base}/' + libname + '/python',
132 'include': '{base}/include/python',
133 'platinclude': '{base}/include/python',
134 'scripts': '{base}/bin',
136 'data' : '{userbase}',
139 - 'stdlib': '{userbase}/lib/python{py_version_short}',
140 - 'platstdlib': '{userbase}/lib/python{py_version_short}',
141 - 'purelib': '{userbase}/lib/python{py_version_short}/site-packages',
142 - 'platlib': '{userbase}/lib/python{py_version_short}/site-packages',
143 + 'stdlib': '{userbase}/' + libname + '/python{py_version_short}',
144 + 'platstdlib': '{userbase}/' + libname + '/python{py_version_short}',
145 + 'purelib': '{userbase}/' + libname + '/python{py_version_short}/site-packages',
146 + 'platlib': '{userbase}/' + libname + '/python{py_version_short}/site-packages',
147 'include': '{userbase}/include/python{py_version_short}',
148 'scripts': '{userbase}/bin',
149 'data' : '{userbase}',
150 diff -durN -x '*~' -x '*.orig' Python-2.7.10.orig/Lib/test/test_site.py Python-2.7.10/Lib/test/test_site.py
151 --- Python-2.7.10.orig/Lib/test/test_site.py 2015-05-23 18:09:12.000000000 +0200
152 +++ Python-2.7.10/Lib/test/test_site.py 2015-12-02 17:54:42.220155116 +0100
155 if sys.platform in ('os2emx', 'riscos'):
156 self.assertEqual(len(dirs), 1)
157 - wanted = os.path.join('xoxo', 'Lib', 'site-packages')
158 + wanted = os.path.join('xoxo', sys.lib, 'site-packages')
159 self.assertEqual(dirs[0], wanted)
160 elif (sys.platform == "darwin" and
161 sysconfig.get_config_var("PYTHONFRAMEWORK")):
162 @@ -241,17 +241,17 @@
163 self.assertEqual(dirs[2], wanted)
165 # OS X non-framwework builds, Linux, FreeBSD, etc
166 - self.assertEqual(len(dirs), 2)
167 - wanted = os.path.join('xoxo', 'lib', 'python' + sys.version[:3],
168 + self.assertEqual(len(dirs), 4)
169 + wanted = os.path.join('xoxo', sys.lib, 'python' + sys.version[:3],
171 self.assertEqual(dirs[0], wanted)
172 - wanted = os.path.join('xoxo', 'lib', 'site-python')
173 + wanted = os.path.join('xoxo', sys.lib, 'site-python')
174 self.assertEqual(dirs[1], wanted)
177 self.assertEqual(len(dirs), 2)
178 self.assertEqual(dirs[0], 'xoxo')
179 - wanted = os.path.join('xoxo', 'lib', 'site-packages')
180 + wanted = os.path.join('xoxo', sys.lib, 'site-packages')
181 self.assertEqual(dirs[1], wanted)
183 class PthFile(object):
184 diff -durN -x '*~' -x '*.orig' Python-2.7.10.orig/Makefile.pre.in Python-2.7.10/Makefile.pre.in
185 --- Python-2.7.10.orig/Makefile.pre.in 2015-12-02 17:53:51.063166393 +0100
186 +++ Python-2.7.10/Makefile.pre.in 2015-12-02 17:54:33.560101256 +0100
189 # Machine-dependent subdirectories
194 # Multiarch directory (may be empty)
195 MULTIARCH= @MULTIARCH@
198 INCLUDEDIR= @includedir@
199 CONFINCLUDEDIR= $(exec_prefix)/include
200 -SCRIPTDIR= $(prefix)/lib
201 +SCRIPTDIR= $(prefix)/$(LIB)
203 # Detailed destination directories
204 BINLIBDEST= $(LIBDIR)/python$(VERSION)
206 Python/compile.o Python/symtable.o Python/ast.o: $(GRAMMAR_H) $(AST_H)
208 Python/getplatform.o: $(srcdir)/Python/getplatform.c
209 - $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
210 + $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -DARCH='"$(ARCH)"' -DLIB='"$(LIB)"' -o $@ $(srcdir)/Python/getplatform.c
212 Python/importdl.o: $(srcdir)/Python/importdl.c
213 $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
214 diff -durN -x '*~' -x '*.orig' Python-2.7.10.orig/Modules/getpath.c Python-2.7.10/Modules/getpath.c
215 --- Python-2.7.10.orig/Modules/getpath.c 2015-05-23 18:09:20.000000000 +0200
216 +++ Python-2.7.10/Modules/getpath.c 2015-12-02 17:54:33.563434609 +0100
218 #define EXEC_PREFIX PREFIX
222 +#if defined(__x86_64__) || (defined(__sparc__) && defined(__arch64__)) || defined(__powerpc64__) || defined(__s390x__)
223 +#if defined(__ILP32__)
224 +#define LIB_PYTHON "libx32/python"
226 +#define LIB_PYTHON "lib64/python"
229 +#define LIB_PYTHON "lib/python"
234 -#define PYTHONPATH PREFIX "/lib/python" VERSION ":" \
235 - EXEC_PREFIX "/lib/python" VERSION "/lib-dynload"
236 +#define PYTHONPATH PREFIX "/" LIB_PYTHON VERSION ":" \
237 + EXEC_PREFIX "/" LIB_PYTHON VERSION "/lib-dynload:"
242 static char exec_prefix[MAXPATHLEN+1];
243 static char progpath[MAXPATHLEN+1];
244 static char *module_search_path = NULL;
245 -static char lib_python[] = "lib/python" VERSION;
246 +static char lib_python[] = LIB_PYTHON VERSION;
250 diff -durN -x '*~' -x '*.orig' Python-2.7.10.orig/Python/getplatform.c Python-2.7.10/Python/getplatform.c
251 --- Python-2.7.10.orig/Python/getplatform.c 2015-05-23 18:09:24.000000000 +0200
252 +++ Python-2.7.10/Python/getplatform.c 2015-12-02 17:54:33.563434609 +0100
259 +#define ARCH "unknown"
277 diff -durN -x '*~' -x '*.orig' Python-2.7.10.orig/Python/sysmodule.c Python-2.7.10/Python/sysmodule.c
278 --- Python-2.7.10.orig/Python/sysmodule.c 2015-05-23 18:09:24.000000000 +0200
279 +++ Python-2.7.10/Python/sysmodule.c 2015-12-02 17:54:33.563434609 +0100
280 @@ -1437,6 +1437,10 @@
281 PyString_FromString(Py_GetCopyright()));
282 SET_SYS_FROM_STRING("platform",
283 PyString_FromString(Py_GetPlatform()));
284 + SET_SYS_FROM_STRING("arch",
285 + PyString_FromString(Py_GetArch()));
286 + SET_SYS_FROM_STRING("lib",
287 + PyString_FromString(Py_GetLib()));
288 SET_SYS_FROM_STRING("executable",
289 PyString_FromString(Py_GetProgramFullPath()));
290 SET_SYS_FROM_STRING("prefix",
291 diff -durN -x '*~' -x '*.orig' Python-2.7.10.orig/configure.ac Python-2.7.10/configure.ac
292 --- Python-2.7.10.orig/configure.ac 2015-12-02 17:53:51.063166393 +0100
293 +++ Python-2.7.10/configure.ac 2015-12-02 17:54:33.560101256 +0100
299 +AC_MSG_CHECKING(ARCH)
304 +AC_MSG_RESULT($ARCH)
307 +AC_MSG_CHECKING(LIB)
308 +case $ac_sys_system in
310 + # Test if the compiler is 64bit
311 + echo 'int i;' > conftest.$ac_ext
312 + python_cv_cc_64bit_output=no
313 + if AC_TRY_EVAL(ac_compile); then
314 + case `/usr/bin/file conftest.$ac_objext` in
316 + python_cv_cc_64bit_output=yes
324 +case $ARCH:$python_cv_cc_64bit_output in
325 +powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes)
338 AC_MSG_CHECKING(LIBRARY)
339 diff -durN -x '*~' -x '*.orig' Python-2.7.10.orig/setup.py Python-2.7.10/setup.py
340 --- Python-2.7.10.orig/setup.py 2015-12-02 17:53:51.053166330 +0100
341 +++ Python-2.7.10/setup.py 2015-12-02 17:54:33.563434609 +0100
347 # lib_dirs and inc_dirs are used to search for files;
348 # if a file is found in one of those directories, it can
349 # be assumed that no additional -I,-L directives are needed.
352 add_dir_to_list(inc_dirs, d)
354 - '/lib64', '/usr/lib64',
355 - '/lib', '/usr/lib',
356 + libname, '/usr/'+libname
358 add_dir_to_list(lib_dirs, d)
360 @@ -762,11 +762,11 @@
362 readline_libs.append(curses_library)
363 elif self.compiler.find_library_file(lib_dirs +
364 - ['/usr/lib/termcap'],
365 + ['/usr' + libname + '/termcap'],
367 readline_libs.append('termcap')
368 exts.append( Extension('readline', ['readline.c'],
369 - library_dirs=['/usr/lib/termcap'],
370 + library_dirs=['/usr' + libname + '/termcap'],
371 extra_link_args=readline_extra_link_args,
372 libraries=readline_libs) )
374 @@ -1925,8 +1925,8 @@
375 added_lib_dirs.append('/usr/openwin/lib')
376 elif os.path.exists('/usr/X11R6/include'):
377 include_dirs.append('/usr/X11R6/include')
378 - added_lib_dirs.append('/usr/X11R6/lib64')
379 - added_lib_dirs.append('/usr/X11R6/lib')
380 + added_lib_dirs.append('/usr/X11R6/'+sys.lib)
381 + #added_lib_dirs.append('/usr/X11R6/lib')
382 elif os.path.exists('/usr/X11R5/include'):
383 include_dirs.append('/usr/X11R5/include')
384 added_lib_dirs.append('/usr/X11R5/lib')