]> git.pld-linux.org Git - packages/python3.git/blame - python3-multilib.patch
Set WITHIN_PYTHON_RPM_BUILD=1 for tests
[packages/python3.git] / python3-multilib.patch
CommitLineData
c7fcbc4e 1diff -dur Python-3.5.0.orig/Include/pylifecycle.h Python-3.5.0/Include/pylifecycle.h
ea93f05f 2--- Python-3.5.0.orig/Include/pylifecycle.h 2015-09-13 13:41:20.000000000 +0200
c7fcbc4e 3+++ Python-3.5.0/Include/pylifecycle.h 2015-12-03 17:31:03.874280444 +0100
ea93f05f 4@@ -65,6 +65,8 @@
e684db95
AM
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);
c7fcbc4e 13diff -dur Python-3.5.0.orig/Lib/distutils/command/install.py Python-3.5.0/Lib/distutils/command/install.py
ea93f05f 14--- Python-3.5.0.orig/Lib/distutils/command/install.py 2015-09-13 13:41:20.000000000 +0200
c7fcbc4e 15+++ Python-3.5.0/Lib/distutils/command/install.py 2015-12-03 17:31:03.874280444 +0100
ea93f05f 16@@ -19,6 +19,8 @@
38874ce8
AM
17 from site import USER_SITE
18 HAS_USER_SITE = True
e684db95
AM
19
20+libname = sys.lib
21+
38874ce8
AM
22 WINDOWS_SCHEME = {
23 'purelib': '$base/Lib/site-packages',
24 'platlib': '$base/Lib/site-packages',
ea93f05f
JK
25@@ -29,15 +31,15 @@
26
e684db95
AM
27 INSTALL_SCHEMES = {
28 'unix_prefix': {
ea93f05f 29- 'purelib': '$base/lib/python$py_version_short/site-packages',
e684db95 30- 'platlib': '$platbase/lib/python$py_version_short/site-packages',
ea93f05f 31+ 'purelib': '$base/'+libname+'/python$py_version_short/site-packages',
e684db95 32+ 'platlib': '$platbase/'+libname+'/python$py_version_short/site-packages',
e3852288 33 'headers': '$base/include/python$py_version_short$abiflags/$dist_name',
e684db95
AM
34 'scripts': '$base/bin',
35 'data' : '$base',
36 },
37 'unix_home': {
ea93f05f 38- 'purelib': '$base/lib/python',
e684db95 39- 'platlib': '$base/lib/python',
ea93f05f 40+ 'purelib': '$base/'+libname+'/python',
e684db95
AM
41+ 'platlib': '$base/'+libname+'/python',
42 'headers': '$base/include/python/$dist_name',
43 'scripts': '$base/bin',
44 'data' : '$base',
c7fcbc4e 45diff -dur Python-3.5.0.orig/Lib/distutils/sysconfig.py Python-3.5.0/Lib/distutils/sysconfig.py
ea93f05f 46--- Python-3.5.0.orig/Lib/distutils/sysconfig.py 2015-09-13 13:41:21.000000000 +0200
c7fcbc4e 47+++ Python-3.5.0/Lib/distutils/sysconfig.py 2015-12-03 17:31:03.874280444 +0100
ea93f05f
JK
48@@ -132,8 +132,12 @@
49 prefix = plat_specific and EXEC_PREFIX or PREFIX
e684db95
AM
50
51 if os.name == "posix":
52+ if plat_specific:
53+ lib = sys.lib
54+ else:
55+ lib = 'lib'
56 libpython = os.path.join(prefix,
57- "lib", "python" + get_python_version())
58+ lib, "python" + get_python_version())
59 if standard_lib:
60 return libpython
61 else:
c7fcbc4e 62diff -dur Python-3.5.0.orig/Lib/distutils/tests/test_install.py Python-3.5.0/Lib/distutils/tests/test_install.py
ea93f05f 63--- Python-3.5.0.orig/Lib/distutils/tests/test_install.py 2015-09-13 13:41:21.000000000 +0200
c7fcbc4e 64+++ Python-3.5.0/Lib/distutils/tests/test_install.py 2015-12-03 17:31:03.874280444 +0100
ea93f05f
JK
65@@ -55,7 +55,7 @@
66 expected = os.path.normpath(expected)
e684db95
AM
67 self.assertEqual(got, expected)
68
ea93f05f
JK
69- libdir = os.path.join(destination, "lib", "python")
70+ libdir = os.path.join(destination, sys.lib, "python")
e684db95 71 check_path(cmd.install_lib, libdir)
ea93f05f 72 check_path(cmd.install_platlib, libdir)
e684db95 73 check_path(cmd.install_purelib, libdir)
c7fcbc4e 74diff -dur Python-3.5.0.orig/Lib/site.py Python-3.5.0/Lib/site.py
ea93f05f 75--- Python-3.5.0.orig/Lib/site.py 2015-09-13 13:41:21.000000000 +0200
c7fcbc4e 76+++ Python-3.5.0/Lib/site.py 2015-12-03 17:31:03.874280444 +0100
ea93f05f 77@@ -303,12 +303,16 @@
38874ce8
AM
78 seen.add(prefix)
79
80 if os.sep == '/':
e3852288
JB
81- sitepackages.append(os.path.join(prefix, "lib",
82+ sitepackages.append(os.path.join(prefix, sys.lib,
04df829f 83 "python" + sys.version[:3],
84 "site-packages"))
e3852288 85+ sitepackages.append(os.path.join(prefix, sys.lib, "site-python"))
04df829f 86+ if sys.lib != 'lib':
e3852288 87+ sitepackages.append(os.path.join(prefix, "lib", "python" + sys.version[:3], "site-packages"))
ea93f05f 88+ sitepackages.append(os.path.join(prefix, "share", "python" + sys.version[:3], "site-packages"))
04df829f 89 else:
e3852288
JB
90 sitepackages.append(prefix)
91- sitepackages.append(os.path.join(prefix, "lib", "site-packages"))
92+ sitepackages.append(os.path.join(prefix, sys.lib, "site-packages"))
04df829f 93 if sys.platform == "darwin":
94 # for framework builds *only* we add the standard Apple
e3852288 95 # locations.
c7fcbc4e 96diff -dur Python-3.5.0.orig/Lib/sysconfig.py Python-3.5.0/Lib/sysconfig.py
ea93f05f 97--- Python-3.5.0.orig/Lib/sysconfig.py 2015-09-13 13:41:21.000000000 +0200
c7fcbc4e 98+++ Python-3.5.0/Lib/sysconfig.py 2015-12-03 17:31:51.974741432 +0100
ea93f05f 99@@ -20,10 +20,10 @@
75257062 100
101 _INSTALL_SCHEMES = {
102 'posix_prefix': {
b88f500a 103- 'stdlib': '{installed_base}/lib/python{py_version_short}',
75257062 104- 'platstdlib': '{platbase}/lib/python{py_version_short}',
ea93f05f
JK
105- 'purelib': '{base}/lib/python{py_version_short}/site-packages',
106- 'platlib': '{platbase}/lib/python{py_version_short}/site-packages',
b88f500a 107+ 'stdlib': '{installed_base}/' + sys.lib + '/python{py_version_short}',
75257062 108+ 'platstdlib': '{platbase}/' + sys.lib + '/python{py_version_short}',
ea93f05f 109+ 'purelib': '{base}/' + sys.lib + '/python{py_version_short}/site-packages',
75257062 110+ 'platlib': '{platbase}/' + sys.lib + '/python{py_version_short}/site-packages',
111 'include':
b88f500a 112 '{installed_base}/include/python{py_version_short}{abiflags}',
75257062 113 'platinclude':
ea93f05f 114@@ -32,10 +32,10 @@
75257062 115 'data': '{base}',
116 },
117 'posix_home': {
b88f500a 118- 'stdlib': '{installed_base}/lib/python',
75257062 119- 'platstdlib': '{base}/lib/python',
ea93f05f
JK
120- 'purelib': '{base}/lib/python',
121- 'platlib': '{base}/lib/python',
b88f500a 122+ 'stdlib': '{installed_base}/' + sys.lib + '/python',
b9c7955e 123+ 'platstdlib': '{base}/' + sys.lib + '/python',
ea93f05f 124+ 'purelib': '{base}/' + sys.lib + '/python',
75257062 125+ 'platlib': '{base}/' + sys.lib + '/python',
b88f500a
AM
126 'include': '{installed_base}/include/python',
127 'platinclude': '{installed_base}/include/python',
75257062 128 'scripts': '{base}/bin',
c7fcbc4e
JK
129@@ -61,10 +61,10 @@
130 'data': '{userbase}',
131 },
132 'posix_user': {
133- 'stdlib': '{userbase}/lib/python{py_version_short}',
134- 'platstdlib': '{userbase}/lib/python{py_version_short}',
135- 'purelib': '{userbase}/lib/python{py_version_short}/site-packages',
136- 'platlib': '{userbase}/lib/python{py_version_short}/site-packages',
137+ 'stdlib': '{userbase}/' + sys.lib + '/python{py_version_short}',
138+ 'platstdlib': '{userbase}/' + sys.lib + '/python{py_version_short}',
139+ 'purelib': '{userbase}/' + sys.lib + '/python{py_version_short}/site-packages',
140+ 'platlib': '{userbase}/' + sys.lib + '/python{py_version_short}/site-packages',
141 'include': '{userbase}/include/python{py_version_short}',
142 'scripts': '{userbase}/bin',
143 'data': '{userbase}',
a033b415
JK
144@@ -459,7 +459,11 @@
145 else:
146 inc_dir = _sys_home or _PROJECT_BASE
147 else:
148- inc_dir = get_path('platinclude')
149+ if hasattr(sys, 'abiflags'):
150+ config_dir_name = 'config-%s%s' % (_PY_VERSION_SHORT, sys.abiflags)
151+ else:
152+ config_dir_name = 'config'
153+ inc_dir = os.path.join(get_path('stdlib'), config_dir_name)
154 return os.path.join(inc_dir, 'pyconfig.h')
155
156
c7fcbc4e 157diff -dur Python-3.5.0.orig/Makefile.pre.in Python-3.5.0/Makefile.pre.in
ea93f05f 158--- Python-3.5.0.orig/Makefile.pre.in 2015-09-13 13:41:23.000000000 +0200
c7fcbc4e 159+++ Python-3.5.0/Makefile.pre.in 2015-12-03 17:31:03.874280444 +0100
ea93f05f 160@@ -101,6 +101,8 @@
e684db95
AM
161
162 # Machine-dependent subdirectories
163 MACHDEP= @MACHDEP@
164+LIB= @LIB@
165+ARCH= @ARCH@
166
ea93f05f
JK
167 # Multiarch directory (may be empty)
168 MULTIARCH= @MULTIARCH@
169@@ -120,7 +122,7 @@
e684db95
AM
170 MANDIR= @mandir@
171 INCLUDEDIR= @includedir@
172 CONFINCLUDEDIR= $(exec_prefix)/include
173-SCRIPTDIR= $(prefix)/lib
174+SCRIPTDIR= $(prefix)/$(LIB)
e3852288 175 ABIFLAGS= @ABIFLAGS@
e684db95
AM
176
177 # Detailed destination directories
ea93f05f 178@@ -796,7 +798,7 @@
e3852288 179 Python/compile.o Python/symtable.o Python/ast.o: $(GRAMMAR_H) $(AST_H)
e684db95
AM
180
181 Python/getplatform.o: $(srcdir)/Python/getplatform.c
e3852288
JB
182- $(CC) -c $(PY_CORE_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
183+ $(CC) -c $(PY_CORE_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -DARCH='"$(ARCH)"' -DLIB='"$(LIB)"' -o $@ $(srcdir)/Python/getplatform.c
e684db95
AM
184
185 Python/importdl.o: $(srcdir)/Python/importdl.c
e3852288 186 $(CC) -c $(PY_CORE_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
ea93f05f
JK
187@@ -1362,8 +1364,8 @@
188 if test "$(SHLIB_SUFFIX)" = .dll; then \
189 $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
190 else \
191- $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
192- $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
193+ $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBDIR)/$(LIBRARY) ; \
194+ $(RANLIB) $(DESTDIR)$(LIBDIR)/$(LIBRARY) ; \
195 fi; \
196 else \
197 echo Skip install of $(LIBRARY) - use make frameworkinstall; \
c7fcbc4e 198diff -dur Python-3.5.0.orig/Modules/getpath.c Python-3.5.0/Modules/getpath.c
ea93f05f 199--- Python-3.5.0.orig/Modules/getpath.c 2015-09-13 13:41:24.000000000 +0200
c7fcbc4e 200+++ Python-3.5.0/Modules/getpath.c 2015-12-03 17:31:03.874280444 +0100
ea93f05f 201@@ -117,9 +117,21 @@
e684db95
AM
202 #define EXEC_PREFIX PREFIX
203 #endif
204
205+#ifndef LIB_PYTHON
206+#if defined(__x86_64__) || (defined(__sparc__) && defined(__arch64__)) || defined(__powerpc64__) || defined(__s390x__)
58274b36
JR
207+#if defined(__ILP32__)
208+#define LIB_PYTHON "libx32/python"
209+#else
38874ce8 210+#define LIB_PYTHON "lib64/python"
58274b36 211+#endif
e684db95 212+#else
38874ce8 213+#define LIB_PYTHON "lib/python"
e684db95
AM
214+#endif
215+#endif
216+
217 #ifndef PYTHONPATH
218-#define PYTHONPATH PREFIX "/lib/python" VERSION ":" \
219- EXEC_PREFIX "/lib/python" VERSION "/lib-dynload"
220+#define PYTHONPATH PREFIX "/" LIB_PYTHON VERSION ":" \
221+ EXEC_PREFIX "/" LIB_PYTHON VERSION "/lib-dynload:"
222 #endif
223
224 #ifndef LANDMARK
ea93f05f 225@@ -511,7 +523,7 @@
ac674191
AM
226 _pythonpath = Py_DecodeLocale(PYTHONPATH, NULL);
227 _prefix = Py_DecodeLocale(PREFIX, NULL);
228 _exec_prefix = Py_DecodeLocale(EXEC_PREFIX, NULL);
229- lib_python = Py_DecodeLocale("lib/python" VERSION, NULL);
230+ lib_python = Py_DecodeLocale(LIB_PYTHON VERSION, NULL);
04df829f 231
38874ce8
AM
232 if (!_pythonpath || !_prefix || !_exec_prefix || !lib_python) {
233 Py_FatalError(
ea93f05f
JK
234@@ -700,7 +712,7 @@
235 }
236 else
237 wcsncpy(zip_path, _prefix, MAXPATHLEN);
238- joinpath(zip_path, L"lib/python00.zip");
239+ joinpath(zip_path, L"" LIB_PYTHON "00.zip");
240 bufsz = wcslen(zip_path); /* Replace "00" with version */
241 zip_path[bufsz - 6] = VERSION[0];
242 zip_path[bufsz - 5] = VERSION[2];
c7fcbc4e 243diff -dur Python-3.5.0.orig/Python/getplatform.c Python-3.5.0/Python/getplatform.c
ea93f05f 244--- Python-3.5.0.orig/Python/getplatform.c 2015-09-13 13:41:26.000000000 +0200
c7fcbc4e 245+++ Python-3.5.0/Python/getplatform.c 2015-12-03 17:31:03.874280444 +0100
e684db95
AM
246@@ -10,3 +10,23 @@
247 {
248 return PLATFORM;
249 }
250+
251+#ifndef ARCH
252+#define ARCH "unknown"
253+#endif
254+
255+const char *
256+Py_GetArch(void)
257+{
258+ return ARCH;
259+}
260+
261+#ifndef LIB
262+#define LIB "lib"
263+#endif
264+
265+const char *
266+Py_GetLib(void)
267+{
268+ return LIB;
269+}
c7fcbc4e 270diff -dur Python-3.5.0.orig/Python/sysmodule.c Python-3.5.0/Python/sysmodule.c
ea93f05f 271--- Python-3.5.0.orig/Python/sysmodule.c 2015-09-13 13:41:26.000000000 +0200
c7fcbc4e 272+++ Python-3.5.0/Python/sysmodule.c 2015-12-03 17:31:03.874280444 +0100
ea93f05f 273@@ -1767,6 +1767,10 @@
e3852288
JB
274 PyUnicode_FromString(Py_GetCopyright()));
275 SET_SYS_FROM_STRING("platform",
276 PyUnicode_FromString(Py_GetPlatform()));
277+ SET_SYS_FROM_STRING("arch",
278+ PyUnicode_FromString(Py_GetArch()));
279+ SET_SYS_FROM_STRING("lib",
280+ PyUnicode_FromString(Py_GetLib()));
281 SET_SYS_FROM_STRING("executable",
282 PyUnicode_FromWideChar(
283 Py_GetProgramFullPath(), -1));
c7fcbc4e
JK
284diff -dur Python-3.5.0.orig/configure.ac Python-3.5.0/configure.ac
285--- Python-3.5.0.orig/configure.ac 2015-12-03 17:30:32.777292009 +0100
286+++ Python-3.5.0/configure.ac 2015-12-03 17:31:03.877613811 +0100
ea93f05f
JK
287@@ -722,6 +722,45 @@
288 ])
289 fi
290
291+AC_SUBST(ARCH)
292+AC_MSG_CHECKING(ARCH)
293+ARCH=`uname -m`
294+case $ARCH in
295+i?86) ARCH=i386;;
296+esac
297+AC_MSG_RESULT($ARCH)
298+
299+AC_SUBST(LIB)
300+AC_MSG_CHECKING(LIB)
301+case $ac_sys_system in
302+Linux*)
303+ # Test if the compiler is 64bit
304+ echo 'int i;' > conftest.$ac_ext
305+ python_cv_cc_64bit_output=no
306+ if AC_TRY_EVAL(ac_compile); then
307+ case `/usr/bin/file conftest.$ac_objext` in
308+ *"ELF 64"*)
309+ python_cv_cc_64bit_output=yes
310+ ;;
311+ esac
312+ fi
313+ rm -rf conftest*
314+ ;;
315+esac
316+
317+case $ARCH:$python_cv_cc_64bit_output in
318+powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes)
319+ LIB="lib64"
320+ ;;
321+x86_64:no)
322+ LIB="libx32"
323+ ;;
324+*:*)
325+ LIB="lib"
326+ ;;
327+esac
328+AC_MSG_RESULT($LIB)
329+
330
331 MULTIARCH=$($CC --print-multiarch 2>/dev/null)
332 AC_SUBST(MULTIARCH)
333@@ -4331,7 +4370,7 @@
334
335 dnl define LIBPL after ABIFLAGS and LDVERSION is defined.
336 AC_SUBST(PY_ENABLE_SHARED)
337-LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}"
338+LIBPL='$(LIBDIR)/python'"${VERSION}/config-${LDVERSION}"
339 AC_SUBST(LIBPL)
340
341 # Check whether right shifting a negative integer extends the sign bit
c7fcbc4e 342diff -dur Python-3.5.0.orig/setup.py Python-3.5.0/setup.py
ea93f05f 343--- Python-3.5.0.orig/setup.py 2015-09-13 13:41:26.000000000 +0200
c7fcbc4e 344+++ Python-3.5.0/setup.py 2015-12-03 17:31:03.877613811 +0100
ea93f05f 345@@ -526,8 +526,7 @@
e684db95 346 # be assumed that no additional -I,-L directives are needed.
b88f500a
AM
347 if not cross_compiling:
348 lib_dirs = self.compiler.library_dirs + [
349- '/lib64', '/usr/lib64',
350- '/lib', '/usr/lib',
08dc552f 351+ '/' + sys.lib, '/usr/' + sys.lib
b88f500a
AM
352 ]
353 inc_dirs = self.compiler.include_dirs + ['/usr/include']
ea93f05f
JK
354 else:
355@@ -750,11 +749,11 @@
e3852288
JB
356 elif curses_library:
357 readline_libs.append(curses_library)
e684db95 358 elif self.compiler.find_library_file(lib_dirs +
e3852288 359- ['/usr/lib/termcap'],
cc48af34 360+ ['/usr/' + sys.lib + '/termcap'],
e3852288 361 'termcap'):
e684db95
AM
362 readline_libs.append('termcap')
363 exts.append( Extension('readline', ['readline.c'],
364- library_dirs=['/usr/lib/termcap'],
cc48af34 365+ library_dirs=['/usr/' + sys.lib + '/termcap'],
e684db95
AM
366 extra_link_args=readline_extra_link_args,
367 libraries=readline_libs) )
e3852288 368 else:
This page took 0.091275 seconds and 4 git commands to generate.