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 19:31:20.058862685 +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 19:31:20.058862685 +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 19:31:20.058862685 +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 19:31:20.058862685 +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 19:31:20.058862685 +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 19:33:48.483250053 +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}',
152 inc_dir = _PROJECT_BASE
154 - inc_dir = get_path('platinclude')
155 + inc_dir = os.path.join(get_path('platstdlib'), "config")
156 return os.path.join(inc_dir, 'pyconfig.h')
158 def get_scheme_names():
159 diff -durN -x '*~' -x '*.orig' Python-2.7.10.orig/Lib/test/test_site.py Python-2.7.10/Lib/test/test_site.py
160 --- Python-2.7.10.orig/Lib/test/test_site.py 2015-05-23 18:09:12.000000000 +0200
161 +++ Python-2.7.10/Lib/test/test_site.py 2015-12-02 19:31:20.058862685 +0100
164 if sys.platform in ('os2emx', 'riscos'):
165 self.assertEqual(len(dirs), 1)
166 - wanted = os.path.join('xoxo', 'Lib', 'site-packages')
167 + wanted = os.path.join('xoxo', sys.lib, 'site-packages')
168 self.assertEqual(dirs[0], wanted)
169 elif (sys.platform == "darwin" and
170 sysconfig.get_config_var("PYTHONFRAMEWORK")):
171 @@ -241,17 +241,17 @@
172 self.assertEqual(dirs[2], wanted)
174 # OS X non-framwework builds, Linux, FreeBSD, etc
175 - self.assertEqual(len(dirs), 2)
176 - wanted = os.path.join('xoxo', 'lib', 'python' + sys.version[:3],
177 + self.assertEqual(len(dirs), 4)
178 + wanted = os.path.join('xoxo', sys.lib, 'python' + sys.version[:3],
180 self.assertEqual(dirs[0], wanted)
181 - wanted = os.path.join('xoxo', 'lib', 'site-python')
182 + wanted = os.path.join('xoxo', sys.lib, 'site-python')
183 self.assertEqual(dirs[1], wanted)
186 self.assertEqual(len(dirs), 2)
187 self.assertEqual(dirs[0], 'xoxo')
188 - wanted = os.path.join('xoxo', 'lib', 'site-packages')
189 + wanted = os.path.join('xoxo', sys.lib, 'site-packages')
190 self.assertEqual(dirs[1], wanted)
192 class PthFile(object):
193 diff -durN -x '*~' -x '*.orig' Python-2.7.10.orig/Makefile.pre.in Python-2.7.10/Makefile.pre.in
194 --- Python-2.7.10.orig/Makefile.pre.in 2015-12-02 19:31:01.322061528 +0100
195 +++ Python-2.7.10/Makefile.pre.in 2015-12-02 19:31:20.058862685 +0100
198 # Machine-dependent subdirectories
203 # Multiarch directory (may be empty)
204 MULTIARCH= @MULTIARCH@
207 INCLUDEDIR= @includedir@
208 CONFINCLUDEDIR= $(exec_prefix)/include
209 -SCRIPTDIR= $(prefix)/lib
210 +SCRIPTDIR= $(prefix)/$(LIB)
212 # Detailed destination directories
213 BINLIBDEST= $(LIBDIR)/python$(VERSION)
215 Python/compile.o Python/symtable.o Python/ast.o: $(GRAMMAR_H) $(AST_H)
217 Python/getplatform.o: $(srcdir)/Python/getplatform.c
218 - $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
219 + $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -DARCH='"$(ARCH)"' -DLIB='"$(LIB)"' -o $@ $(srcdir)/Python/getplatform.c
221 Python/importdl.o: $(srcdir)/Python/importdl.c
222 $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
223 diff -durN -x '*~' -x '*.orig' Python-2.7.10.orig/Modules/getpath.c Python-2.7.10/Modules/getpath.c
224 --- Python-2.7.10.orig/Modules/getpath.c 2015-05-23 18:09:20.000000000 +0200
225 +++ Python-2.7.10/Modules/getpath.c 2015-12-02 19:31:20.062196042 +0100
227 #define EXEC_PREFIX PREFIX
231 +#if defined(__x86_64__) || (defined(__sparc__) && defined(__arch64__)) || defined(__powerpc64__) || defined(__s390x__)
232 +#if defined(__ILP32__)
233 +#define LIB_PYTHON "libx32/python"
235 +#define LIB_PYTHON "lib64/python"
238 +#define LIB_PYTHON "lib/python"
243 -#define PYTHONPATH PREFIX "/lib/python" VERSION ":" \
244 - EXEC_PREFIX "/lib/python" VERSION "/lib-dynload"
245 +#define PYTHONPATH PREFIX "/" LIB_PYTHON VERSION ":" \
246 + EXEC_PREFIX "/" LIB_PYTHON VERSION "/lib-dynload:"
251 static char exec_prefix[MAXPATHLEN+1];
252 static char progpath[MAXPATHLEN+1];
253 static char *module_search_path = NULL;
254 -static char lib_python[] = "lib/python" VERSION;
255 +static char lib_python[] = LIB_PYTHON VERSION;
259 diff -durN -x '*~' -x '*.orig' Python-2.7.10.orig/Python/getplatform.c Python-2.7.10/Python/getplatform.c
260 --- Python-2.7.10.orig/Python/getplatform.c 2015-05-23 18:09:24.000000000 +0200
261 +++ Python-2.7.10/Python/getplatform.c 2015-12-02 19:31:20.062196042 +0100
268 +#define ARCH "unknown"
286 diff -durN -x '*~' -x '*.orig' Python-2.7.10.orig/Python/sysmodule.c Python-2.7.10/Python/sysmodule.c
287 --- Python-2.7.10.orig/Python/sysmodule.c 2015-05-23 18:09:24.000000000 +0200
288 +++ Python-2.7.10/Python/sysmodule.c 2015-12-02 19:31:20.062196042 +0100
289 @@ -1437,6 +1437,10 @@
290 PyString_FromString(Py_GetCopyright()));
291 SET_SYS_FROM_STRING("platform",
292 PyString_FromString(Py_GetPlatform()));
293 + SET_SYS_FROM_STRING("arch",
294 + PyString_FromString(Py_GetArch()));
295 + SET_SYS_FROM_STRING("lib",
296 + PyString_FromString(Py_GetLib()));
297 SET_SYS_FROM_STRING("executable",
298 PyString_FromString(Py_GetProgramFullPath()));
299 SET_SYS_FROM_STRING("prefix",
300 diff -durN -x '*~' -x '*.orig' Python-2.7.10.orig/configure.ac Python-2.7.10/configure.ac
301 --- Python-2.7.10.orig/configure.ac 2015-12-02 19:31:01.322061528 +0100
302 +++ Python-2.7.10/configure.ac 2015-12-02 19:31:20.062196042 +0100
308 +AC_MSG_CHECKING(ARCH)
313 +AC_MSG_RESULT($ARCH)
316 +AC_MSG_CHECKING(LIB)
317 +case $ac_sys_system in
319 + # Test if the compiler is 64bit
320 + echo 'int i;' > conftest.$ac_ext
321 + python_cv_cc_64bit_output=no
322 + if AC_TRY_EVAL(ac_compile); then
323 + case `/usr/bin/file conftest.$ac_objext` in
325 + python_cv_cc_64bit_output=yes
333 +case $ARCH:$python_cv_cc_64bit_output in
334 +powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes)
347 AC_MSG_CHECKING(LIBRARY)
348 diff -durN -x '*~' -x '*.orig' Python-2.7.10.orig/setup.py Python-2.7.10/setup.py
349 --- Python-2.7.10.orig/setup.py 2015-12-02 19:31:01.312061456 +0100
350 +++ Python-2.7.10/setup.py 2015-12-02 19:31:20.062196042 +0100
356 # lib_dirs and inc_dirs are used to search for files;
357 # if a file is found in one of those directories, it can
358 # be assumed that no additional -I,-L directives are needed.
361 add_dir_to_list(inc_dirs, d)
363 - '/lib64', '/usr/lib64',
364 - '/lib', '/usr/lib',
365 + libname, '/usr/'+libname
367 add_dir_to_list(lib_dirs, d)
369 @@ -762,11 +762,11 @@
371 readline_libs.append(curses_library)
372 elif self.compiler.find_library_file(lib_dirs +
373 - ['/usr/lib/termcap'],
374 + ['/usr' + libname + '/termcap'],
376 readline_libs.append('termcap')
377 exts.append( Extension('readline', ['readline.c'],
378 - library_dirs=['/usr/lib/termcap'],
379 + library_dirs=['/usr' + libname + '/termcap'],
380 extra_link_args=readline_extra_link_args,
381 libraries=readline_libs) )
383 @@ -1925,8 +1925,8 @@
384 added_lib_dirs.append('/usr/openwin/lib')
385 elif os.path.exists('/usr/X11R6/include'):
386 include_dirs.append('/usr/X11R6/include')
387 - added_lib_dirs.append('/usr/X11R6/lib64')
388 - added_lib_dirs.append('/usr/X11R6/lib')
389 + added_lib_dirs.append('/usr/X11R6/'+sys.lib)
390 + #added_lib_dirs.append('/usr/X11R6/lib')
391 elif os.path.exists('/usr/X11R5/include'):
392 include_dirs.append('/usr/X11R5/include')
393 added_lib_dirs.append('/usr/X11R5/lib')