]> git.pld-linux.org Git - packages/python.git/blob - python-multilib.patch
1bbc0e1989ea44b5aed40501b41b91edd860f7a6
[packages/python.git] / python-multilib.patch
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
4 @@ -108,6 +108,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 -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
16 @@ -22,6 +22,8 @@
17  from site import USER_SITE
18  
19  
20 +libname = sys.lib
21 +
22  if sys.version < "2.2":
23      WINDOWS_SCHEME = {
24          'purelib': '$base',
25 @@ -41,15 +43,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/$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 -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
48 @@ -119,8 +119,12 @@
49          prefix = plat_specific and EXEC_PREFIX or PREFIX
50  
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())
57 +        else:
58 +            libpython = os.path.join(prefix,
59 +                                 "share", "python" + get_python_version())
60          if standard_lib:
61              return libpython
62          else:
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
66 @@ -56,7 +56,7 @@
67              expected = os.path.normpath(expected)
68              self.assertEqual(got, expected)
69  
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
78 @@ -288,13 +288,17 @@
79          if sys.platform in ('os2emx', 'riscos'):
80              sitepackages.append(os.path.join(prefix, "Lib", "site-packages"))
81          elif os.sep == '/':
82 -            sitepackages.append(os.path.join(prefix, "lib",
83 +            sitepackages.append(os.path.join(prefix, sys.lib,
84                                          "python" + sys.version[:3],
85                                          "site-packages"))
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],
90 +                "site-packages"))
91 +            sitepackages.append(os.path.join(prefix, "share", "site-python"))
92          else:
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
98              # locations.
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
102 @@ -5,22 +5,24 @@
103  import os
104  from os.path import pardir, realpath
105  
106 +libname = sys.lib
107 +
108  _INSTALL_SCHEMES = {
109      'posix_prefix': {
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',
121          'data': '{base}',
122          },
123      'posix_home': {
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',
135 @@ -65,10 +67,10 @@
136          'data'   : '{userbase}',
137          },
138      'posix_user': {
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 @@ -409,7 +411,7 @@
151          else:
152              inc_dir = _PROJECT_BASE
153      else:
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')
157  
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
162 @@ -226,7 +226,7 @@
163  
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)
173          elif os.sep == '/':
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],
179                                    'site-packages')
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)
184          else:
185              # other platforms
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)
191  
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
196 @@ -87,6 +87,8 @@
197  
198  # Machine-dependent subdirectories
199  MACHDEP=       @MACHDEP@
200 +LIB=           @LIB@
201 +ARCH=          @ARCH@
202  
203  # Multiarch directory (may be empty)
204  MULTIARCH=     @MULTIARCH@
205 @@ -106,7 +108,7 @@
206  MANDIR=                @mandir@
207  INCLUDEDIR=    @includedir@
208  CONFINCLUDEDIR=        $(exec_prefix)/include
209 -SCRIPTDIR=     $(prefix)/lib
210 +SCRIPTDIR=     $(prefix)/$(LIB)
211  
212  # Detailed destination directories
213  BINLIBDEST=    $(LIBDIR)/python$(VERSION)
214 @@ -639,7 +641,7 @@
215  Python/compile.o Python/symtable.o Python/ast.o: $(GRAMMAR_H) $(AST_H)
216  
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
220  
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
226 @@ -116,9 +116,21 @@
227  #define EXEC_PREFIX PREFIX
228  #endif
229  
230 +#ifndef LIB_PYTHON
231 +#if defined(__x86_64__) || (defined(__sparc__) && defined(__arch64__)) || defined(__powerpc64__) || defined(__s390x__)
232 +#if defined(__ILP32__)
233 +#define LIB_PYTHON "libx32/python"
234 +#else
235 +#define LIB_PYTHON "lib64/python"
236 +#endif
237 +#else
238 +#define LIB_PYTHON "lib/python"
239 +#endif
240 +#endif
241 +
242  #ifndef PYTHONPATH
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:"
247  #endif
248  
249  #ifndef LANDMARK
250 @@ -129,7 +141,7 @@
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;
256  
257  static void
258  reduce(char *dir)
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
262 @@ -10,3 +10,23 @@
263  {
264         return PLATFORM;
265  }
266 +
267 +#ifndef ARCH
268 +#define ARCH "unknown"
269 +#endif
270 +
271 +const char *
272 +Py_GetArch(void)
273 +{
274 +       return ARCH;
275 +}
276 +
277 +#ifndef LIB
278 +#define LIB "lib"
279 +#endif
280 +
281 +const char *
282 +Py_GetLib(void)
283 +{
284 +       return LIB;
285 +}
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
303 @@ -739,6 +739,44 @@
304      ;;
305  esac
306  
307 +AC_SUBST(ARCH)
308 +AC_MSG_CHECKING(ARCH)
309 +ARCH=`uname -m`
310 +case $ARCH in
311 +i?86) ARCH=i386;;
312 +esac
313 +AC_MSG_RESULT($ARCH)
314 +
315 +AC_SUBST(LIB)
316 +AC_MSG_CHECKING(LIB)
317 +case $ac_sys_system in
318 +Linux*)
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
324 +    *"ELF 64"*)
325 +      python_cv_cc_64bit_output=yes
326 +      ;;
327 +    esac
328 +  fi
329 +  rm -rf conftest*
330 +  ;;
331 +esac
332 +
333 +case $ARCH:$python_cv_cc_64bit_output in
334 +powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes)
335 +  LIB="lib64"
336 +  ;;
337 +x86_64:no)
338 +  LIB="libx32"
339 +  ;;
340 +*:*)
341 +  LIB="lib"
342 +  ;;
343 +esac
344 +AC_MSG_RESULT($LIB)
345  
346  AC_SUBST(LIBRARY)
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
351 @@ -496,6 +496,7 @@
352          except NameError:
353              have_unicode = 0
354  
355 +        libname = sys.lib
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.
359 @@ -507,8 +508,7 @@
360                  ):
361                  add_dir_to_list(inc_dirs, d)
362              for d in (
363 -                '/lib64', '/usr/lib64',
364 -                '/lib', '/usr/lib',
365 +                libname, '/usr/'+libname
366                  ):
367                  add_dir_to_list(lib_dirs, d)
368          exts = []
369 @@ -762,11 +762,11 @@
370              elif curses_library:
371                  readline_libs.append(curses_library)
372              elif self.compiler.find_library_file(lib_dirs +
373 -                                                     ['/usr/lib/termcap'],
374 +                                                     ['/usr' + libname + '/termcap'],
375                                                       '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) )
382          else:
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')
This page took 0.116924 seconds and 2 git commands to generate.