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