]> git.pld-linux.org Git - packages/python3.git/blame - python3-multilib.patch
Do not use $prefix/share in default install scheme
[packages/python3.git] / python3-multilib.patch
CommitLineData
ea93f05f
JK
1diff -dur -x '*~' -x '*.orig' Python-3.5.0.orig/Include/pylifecycle.h Python-3.5.0/Include/pylifecycle.h
2--- Python-3.5.0.orig/Include/pylifecycle.h 2015-09-13 13:41:20.000000000 +0200
3+++ Python-3.5.0/Include/pylifecycle.h 2015-12-02 20:26:50.853793088 +0100
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);
ea93f05f
JK
13diff -dur -x '*~' -x '*.orig' Python-3.5.0.orig/Lib/distutils/command/install.py Python-3.5.0/Lib/distutils/command/install.py
14--- Python-3.5.0.orig/Lib/distutils/command/install.py 2015-09-13 13:41:20.000000000 +0200
15+++ Python-3.5.0/Lib/distutils/command/install.py 2015-12-02 20:27:40.150761675 +0100
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',
ea93f05f
JK
45diff -dur -x '*~' -x '*.orig' Python-3.5.0.orig/Lib/distutils/sysconfig.py Python-3.5.0/Lib/distutils/sysconfig.py
46--- Python-3.5.0.orig/Lib/distutils/sysconfig.py 2015-09-13 13:41:21.000000000 +0200
47+++ Python-3.5.0/Lib/distutils/sysconfig.py 2015-12-02 20:26:50.853793088 +0100
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:
ea93f05f
JK
62diff -dur -x '*~' -x '*.orig' Python-3.5.0.orig/Lib/distutils/tests/test_install.py Python-3.5.0/Lib/distutils/tests/test_install.py
63--- Python-3.5.0.orig/Lib/distutils/tests/test_install.py 2015-09-13 13:41:21.000000000 +0200
64+++ Python-3.5.0/Lib/distutils/tests/test_install.py 2015-12-02 20:26:50.853793088 +0100
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)
ea93f05f
JK
74diff -dur -x '*~' -x '*.orig' Python-3.5.0.orig/Lib/site.py Python-3.5.0/Lib/site.py
75--- Python-3.5.0.orig/Lib/site.py 2015-09-13 13:41:21.000000000 +0200
76+++ Python-3.5.0/Lib/site.py 2015-12-02 20:28:51.431199018 +0100
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.
ea93f05f
JK
96diff -dur -x '*~' -x '*.orig' Python-3.5.0.orig/Lib/sysconfig.py Python-3.5.0/Lib/sysconfig.py
97--- Python-3.5.0.orig/Lib/sysconfig.py 2015-09-13 13:41:21.000000000 +0200
98+++ Python-3.5.0/Lib/sysconfig.py 2015-12-02 20:26:50.853793088 +0100
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',
ea93f05f
JK
129diff -dur -x '*~' -x '*.orig' Python-3.5.0.orig/Makefile.pre.in Python-3.5.0/Makefile.pre.in
130--- Python-3.5.0.orig/Makefile.pre.in 2015-09-13 13:41:23.000000000 +0200
131+++ Python-3.5.0/Makefile.pre.in 2015-12-02 20:28:51.434532372 +0100
132@@ -101,6 +101,8 @@
e684db95
AM
133
134 # Machine-dependent subdirectories
135 MACHDEP= @MACHDEP@
136+LIB= @LIB@
137+ARCH= @ARCH@
138
ea93f05f
JK
139 # Multiarch directory (may be empty)
140 MULTIARCH= @MULTIARCH@
141@@ -120,7 +122,7 @@
e684db95
AM
142 MANDIR= @mandir@
143 INCLUDEDIR= @includedir@
144 CONFINCLUDEDIR= $(exec_prefix)/include
145-SCRIPTDIR= $(prefix)/lib
146+SCRIPTDIR= $(prefix)/$(LIB)
e3852288 147 ABIFLAGS= @ABIFLAGS@
e684db95
AM
148
149 # Detailed destination directories
ea93f05f 150@@ -796,7 +798,7 @@
e3852288 151 Python/compile.o Python/symtable.o Python/ast.o: $(GRAMMAR_H) $(AST_H)
e684db95
AM
152
153 Python/getplatform.o: $(srcdir)/Python/getplatform.c
e3852288
JB
154- $(CC) -c $(PY_CORE_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
155+ $(CC) -c $(PY_CORE_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -DARCH='"$(ARCH)"' -DLIB='"$(LIB)"' -o $@ $(srcdir)/Python/getplatform.c
e684db95
AM
156
157 Python/importdl.o: $(srcdir)/Python/importdl.c
e3852288 158 $(CC) -c $(PY_CORE_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
ea93f05f
JK
159@@ -1362,8 +1364,8 @@
160 if test "$(SHLIB_SUFFIX)" = .dll; then \
161 $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
162 else \
163- $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
164- $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
165+ $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBDIR)/$(LIBRARY) ; \
166+ $(RANLIB) $(DESTDIR)$(LIBDIR)/$(LIBRARY) ; \
167 fi; \
168 else \
169 echo Skip install of $(LIBRARY) - use make frameworkinstall; \
170diff -dur -x '*~' -x '*.orig' Python-3.5.0.orig/Modules/getpath.c Python-3.5.0/Modules/getpath.c
171--- Python-3.5.0.orig/Modules/getpath.c 2015-09-13 13:41:24.000000000 +0200
172+++ Python-3.5.0/Modules/getpath.c 2015-12-02 20:26:50.857126441 +0100
173@@ -117,9 +117,21 @@
e684db95
AM
174 #define EXEC_PREFIX PREFIX
175 #endif
176
177+#ifndef LIB_PYTHON
178+#if defined(__x86_64__) || (defined(__sparc__) && defined(__arch64__)) || defined(__powerpc64__) || defined(__s390x__)
58274b36
JR
179+#if defined(__ILP32__)
180+#define LIB_PYTHON "libx32/python"
181+#else
38874ce8 182+#define LIB_PYTHON "lib64/python"
58274b36 183+#endif
e684db95 184+#else
38874ce8 185+#define LIB_PYTHON "lib/python"
e684db95
AM
186+#endif
187+#endif
188+
189 #ifndef PYTHONPATH
190-#define PYTHONPATH PREFIX "/lib/python" VERSION ":" \
191- EXEC_PREFIX "/lib/python" VERSION "/lib-dynload"
192+#define PYTHONPATH PREFIX "/" LIB_PYTHON VERSION ":" \
193+ EXEC_PREFIX "/" LIB_PYTHON VERSION "/lib-dynload:"
194 #endif
195
196 #ifndef LANDMARK
ea93f05f 197@@ -511,7 +523,7 @@
ac674191
AM
198 _pythonpath = Py_DecodeLocale(PYTHONPATH, NULL);
199 _prefix = Py_DecodeLocale(PREFIX, NULL);
200 _exec_prefix = Py_DecodeLocale(EXEC_PREFIX, NULL);
201- lib_python = Py_DecodeLocale("lib/python" VERSION, NULL);
202+ lib_python = Py_DecodeLocale(LIB_PYTHON VERSION, NULL);
04df829f 203
38874ce8
AM
204 if (!_pythonpath || !_prefix || !_exec_prefix || !lib_python) {
205 Py_FatalError(
ea93f05f
JK
206@@ -700,7 +712,7 @@
207 }
208 else
209 wcsncpy(zip_path, _prefix, MAXPATHLEN);
210- joinpath(zip_path, L"lib/python00.zip");
211+ joinpath(zip_path, L"" LIB_PYTHON "00.zip");
212 bufsz = wcslen(zip_path); /* Replace "00" with version */
213 zip_path[bufsz - 6] = VERSION[0];
214 zip_path[bufsz - 5] = VERSION[2];
215diff -dur -x '*~' -x '*.orig' Python-3.5.0.orig/Python/getplatform.c Python-3.5.0/Python/getplatform.c
216--- Python-3.5.0.orig/Python/getplatform.c 2015-09-13 13:41:26.000000000 +0200
217+++ Python-3.5.0/Python/getplatform.c 2015-12-02 20:26:50.857126441 +0100
e684db95
AM
218@@ -10,3 +10,23 @@
219 {
220 return PLATFORM;
221 }
222+
223+#ifndef ARCH
224+#define ARCH "unknown"
225+#endif
226+
227+const char *
228+Py_GetArch(void)
229+{
230+ return ARCH;
231+}
232+
233+#ifndef LIB
234+#define LIB "lib"
235+#endif
236+
237+const char *
238+Py_GetLib(void)
239+{
240+ return LIB;
241+}
ea93f05f
JK
242diff -dur -x '*~' -x '*.orig' Python-3.5.0.orig/Python/sysmodule.c Python-3.5.0/Python/sysmodule.c
243--- Python-3.5.0.orig/Python/sysmodule.c 2015-09-13 13:41:26.000000000 +0200
244+++ Python-3.5.0/Python/sysmodule.c 2015-12-02 20:26:50.857126441 +0100
245@@ -1767,6 +1767,10 @@
e3852288
JB
246 PyUnicode_FromString(Py_GetCopyright()));
247 SET_SYS_FROM_STRING("platform",
248 PyUnicode_FromString(Py_GetPlatform()));
249+ SET_SYS_FROM_STRING("arch",
250+ PyUnicode_FromString(Py_GetArch()));
251+ SET_SYS_FROM_STRING("lib",
252+ PyUnicode_FromString(Py_GetLib()));
253 SET_SYS_FROM_STRING("executable",
254 PyUnicode_FromWideChar(
255 Py_GetProgramFullPath(), -1));
ea93f05f
JK
256diff -dur -x '*~' -x '*.orig' Python-3.5.0.orig/configure.ac Python-3.5.0/configure.ac
257--- Python-3.5.0.orig/configure.ac 2015-12-02 20:26:33.157018154 +0100
258+++ Python-3.5.0/configure.ac 2015-12-02 20:28:51.431199018 +0100
259@@ -722,6 +722,45 @@
260 ])
261 fi
262
263+AC_SUBST(ARCH)
264+AC_MSG_CHECKING(ARCH)
265+ARCH=`uname -m`
266+case $ARCH in
267+i?86) ARCH=i386;;
268+esac
269+AC_MSG_RESULT($ARCH)
270+
271+AC_SUBST(LIB)
272+AC_MSG_CHECKING(LIB)
273+case $ac_sys_system in
274+Linux*)
275+ # Test if the compiler is 64bit
276+ echo 'int i;' > conftest.$ac_ext
277+ python_cv_cc_64bit_output=no
278+ if AC_TRY_EVAL(ac_compile); then
279+ case `/usr/bin/file conftest.$ac_objext` in
280+ *"ELF 64"*)
281+ python_cv_cc_64bit_output=yes
282+ ;;
283+ esac
284+ fi
285+ rm -rf conftest*
286+ ;;
287+esac
288+
289+case $ARCH:$python_cv_cc_64bit_output in
290+powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes)
291+ LIB="lib64"
292+ ;;
293+x86_64:no)
294+ LIB="libx32"
295+ ;;
296+*:*)
297+ LIB="lib"
298+ ;;
299+esac
300+AC_MSG_RESULT($LIB)
301+
302
303 MULTIARCH=$($CC --print-multiarch 2>/dev/null)
304 AC_SUBST(MULTIARCH)
305@@ -4331,7 +4370,7 @@
306
307 dnl define LIBPL after ABIFLAGS and LDVERSION is defined.
308 AC_SUBST(PY_ENABLE_SHARED)
309-LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}"
310+LIBPL='$(LIBDIR)/python'"${VERSION}/config-${LDVERSION}"
311 AC_SUBST(LIBPL)
312
313 # Check whether right shifting a negative integer extends the sign bit
314diff -dur -x '*~' -x '*.orig' Python-3.5.0.orig/setup.py Python-3.5.0/setup.py
315--- Python-3.5.0.orig/setup.py 2015-09-13 13:41:26.000000000 +0200
316+++ Python-3.5.0/setup.py 2015-12-02 20:26:50.857126441 +0100
317@@ -526,8 +526,7 @@
e684db95 318 # be assumed that no additional -I,-L directives are needed.
b88f500a
AM
319 if not cross_compiling:
320 lib_dirs = self.compiler.library_dirs + [
321- '/lib64', '/usr/lib64',
322- '/lib', '/usr/lib',
08dc552f 323+ '/' + sys.lib, '/usr/' + sys.lib
b88f500a
AM
324 ]
325 inc_dirs = self.compiler.include_dirs + ['/usr/include']
ea93f05f
JK
326 else:
327@@ -750,11 +749,11 @@
e3852288
JB
328 elif curses_library:
329 readline_libs.append(curses_library)
e684db95 330 elif self.compiler.find_library_file(lib_dirs +
e3852288 331- ['/usr/lib/termcap'],
cc48af34 332+ ['/usr/' + sys.lib + '/termcap'],
e3852288 333 'termcap'):
e684db95
AM
334 readline_libs.append('termcap')
335 exts.append( Extension('readline', ['readline.c'],
336- library_dirs=['/usr/lib/termcap'],
cc48af34 337+ library_dirs=['/usr/' + sys.lib + '/termcap'],
e684db95
AM
338 extra_link_args=readline_extra_link_args,
339 libraries=readline_libs) )
e3852288 340 else:
This page took 1.18146 seconds and 4 git commands to generate.