]> git.pld-linux.org Git - packages/python.git/blob - python-multilib.patch
- up to 2.7.17
[packages/python.git] / python-multilib.patch
1 --- Python-2.7.10.orig/Include/pythonrun.h      2015-05-23 18:09:00.000000000 +0200
2 +++ Python-2.7.10/Include/pythonrun.h   2015-12-02 19:31:20.058862685 +0100
3 @@ -108,6 +108,8 @@
4  /* In their own files */
5  PyAPI_FUNC(const char *) Py_GetVersion(void);
6  PyAPI_FUNC(const char *) Py_GetPlatform(void);
7 +PyAPI_FUNC(const char *) Py_GetArch(void);
8 +PyAPI_FUNC(const char *) Py_GetLib(void);
9  PyAPI_FUNC(const char *) Py_GetCopyright(void);
10  PyAPI_FUNC(const char *) Py_GetCompiler(void);
11  PyAPI_FUNC(const char *) Py_GetBuildInfo(void);
12 --- Python-2.7.10.orig/Lib/distutils/command/install.py 2015-05-23 18:09:01.000000000 +0200
13 +++ Python-2.7.10/Lib/distutils/command/install.py      2015-12-02 19:31:20.058862685 +0100
14 @@ -22,6 +22,8 @@
15  from site import USER_SITE
16  
17  
18 +libname = sys.lib
19 +
20  if sys.version < "2.2":
21      WINDOWS_SCHEME = {
22          'purelib': '$base',
23 @@ -41,15 +43,15 @@
24  
25  INSTALL_SCHEMES = {
26      'unix_prefix': {
27 -        'purelib': '$base/lib/python$py_version_short/site-packages',
28 -        'platlib': '$platbase/lib/python$py_version_short/site-packages',
29 +        'purelib': '$base/'+libname+'/python$py_version_short/site-packages',
30 +        'platlib': '$platbase/'+libname+'/python$py_version_short/site-packages',
31          'headers': '$base/include/python$py_version_short/$dist_name',
32          'scripts': '$base/bin',
33          'data'   : '$base',
34          },
35      'unix_home': {
36 -        'purelib': '$base/lib/python',
37 -        'platlib': '$base/lib/python',
38 +        'purelib': '$base/'+libname+'/python',
39 +        'platlib': '$base/'+libname+'/python',
40          'headers': '$base/include/python/$dist_name',
41          'scripts': '$base/bin',
42          'data'   : '$base',
43 --- Python-2.7.10.orig/Lib/distutils/sysconfig.py       2015-05-23 18:09:02.000000000 +0200
44 +++ Python-2.7.10/Lib/distutils/sysconfig.py    2015-12-02 19:31:20.058862685 +0100
45 @@ -119,8 +119,12 @@
46          prefix = plat_specific and EXEC_PREFIX or PREFIX
47  
48      if os.name == "posix":
49 -        libpython = os.path.join(prefix,
50 -                                 "lib", "python" + get_python_version())
51 +        if plat_specific or standard_lib or prefix != "/usr":
52 +            libpython = os.path.join(prefix,
53 +                                 sys.lib, "python" + get_python_version())
54 +        else:
55 +            libpython = os.path.join(prefix,
56 +                                 "share", "python" + get_python_version())
57          if standard_lib:
58              return libpython
59          else:
60 --- Python-2.7.10.orig/Lib/distutils/tests/test_install.py      2015-05-23 18:09:02.000000000 +0200
61 +++ Python-2.7.10/Lib/distutils/tests/test_install.py   2015-12-02 19:31:20.058862685 +0100
62 @@ -56,7 +56,7 @@
63              expected = os.path.normpath(expected)
64              self.assertEqual(got, expected)
65  
66 -        libdir = os.path.join(destination, "lib", "python")
67 +        libdir =  os.path.join(destination, sys.lib, "python")
68          check_path(cmd.install_lib, libdir)
69          check_path(cmd.install_platlib, libdir)
70          check_path(cmd.install_purelib, libdir)
71 --- Python-2.7.10.orig/Lib/site.py      2015-05-23 18:09:06.000000000 +0200
72 +++ Python-2.7.10/Lib/site.py   2015-12-02 19:31:20.058862685 +0100
73 @@ -288,13 +288,18 @@ def getsitepackages():
74          if sys.platform in ('os2emx', 'riscos'):
75              sitepackages.append(os.path.join(prefix, "Lib", "site-packages"))
76          elif os.sep == '/':
77 -            sitepackages.append(os.path.join(prefix, "lib",
78 +            sitepackages.append(os.path.join(prefix, sys.lib,
79                                          "python" + sys.version[:3],
80                                          "site-packages"))
81 -            sitepackages.append(os.path.join(prefix, "lib", "site-python"))
82 +            sitepackages.append(os.path.join(prefix, sys.lib, "site-python"))
83 +            sitepackages.append(os.path.join(prefix, "share",
84 +                                        "python" + sys.version[:3],
85 +                                        "site-packages"))
86 +            sitepackages.append(os.path.join(prefix, "share", "site-python"))
87 +
88          else:
89              sitepackages.append(prefix)
90 -            sitepackages.append(os.path.join(prefix, "lib", "site-packages"))
91 +            sitepackages.append(os.path.join(prefix, sys.lib, "site-packages"))
92      return sitepackages
93  
94  def addsitepackages(known_paths):
95 --- Python-2.7.10.orig/Lib/sysconfig.py 2015-05-23 18:09:07.000000000 +0200
96 +++ Python-2.7.10/Lib/sysconfig.py      2015-12-02 19:33:48.483250053 +0100
97 @@ -5,22 +5,24 @@
98  import os
99  from os.path import pardir, realpath
100  
101 +libname = sys.lib
102 +
103  _INSTALL_SCHEMES = {
104      'posix_prefix': {
105 -        'stdlib': '{base}/lib/python{py_version_short}',
106 -        'platstdlib': '{platbase}/lib/python{py_version_short}',
107 -        'purelib': '{base}/lib/python{py_version_short}/site-packages',
108 -        'platlib': '{platbase}/lib/python{py_version_short}/site-packages',
109 +        'stdlib': '{base}/' + libname + '/python{py_version_short}',
110 +        'platstdlib': '{platbase}/' + libname + '/python{py_version_short}',
111 +        'purelib': '{base}/' + libname + '/python{py_version_short}/site-packages',
112 +        'platlib': '{platbase}/' + libname + '/python{py_version_short}/site-packages',
113          'include': '{base}/include/python{py_version_short}',
114          'platinclude': '{platbase}/include/python{py_version_short}',
115          'scripts': '{base}/bin',
116          'data': '{base}',
117          },
118      'posix_home': {
119 -        'stdlib': '{base}/lib/python',
120 -        'platstdlib': '{base}/lib/python',
121 -        'purelib': '{base}/lib/python',
122 -        'platlib': '{base}/lib/python',
123 +        'stdlib': '{base}/' + libname + '/python',
124 +        'platstdlib': '{base}/' + libname + '/python',
125 +        'purelib': '{base}/' + libname + '/python',
126 +        'platlib': '{base}/' + libname + '/python',
127          'include': '{base}/include/python',
128          'platinclude': '{base}/include/python',
129          'scripts': '{base}/bin',
130 @@ -65,10 +67,10 @@
131          'data'   : '{userbase}',
132          },
133      'posix_user': {
134 -        'stdlib': '{userbase}/lib/python{py_version_short}',
135 -        'platstdlib': '{userbase}/lib/python{py_version_short}',
136 -        'purelib': '{userbase}/lib/python{py_version_short}/site-packages',
137 -        'platlib': '{userbase}/lib/python{py_version_short}/site-packages',
138 +        'stdlib': '{userbase}/' + libname + '/python{py_version_short}',
139 +        'platstdlib': '{userbase}/' + libname + '/python{py_version_short}',
140 +        'purelib': '{userbase}/' + libname + '/python{py_version_short}/site-packages',
141 +        'platlib': '{userbase}/' + libname + '/python{py_version_short}/site-packages',
142          'include': '{userbase}/include/python{py_version_short}',
143          'scripts': '{userbase}/bin',
144          'data'   : '{userbase}',
145 @@ -409,7 +411,7 @@
146          else:
147              inc_dir = _PROJECT_BASE
148      else:
149 -        inc_dir = get_path('platinclude')
150 +        inc_dir = os.path.join(get_path('platstdlib'), "config")
151      return os.path.join(inc_dir, 'pyconfig.h')
152  
153  def get_scheme_names():
154 --- Python-2.7.10.orig/Lib/test/test_site.py    2015-05-23 18:09:12.000000000 +0200
155 +++ Python-2.7.10/Lib/test/test_site.py 2015-12-02 19:31:20.058862685 +0100
156 @@ -226,7 +226,7 @@
157  
158          if sys.platform in ('os2emx', 'riscos'):
159              self.assertEqual(len(dirs), 1)
160 -            wanted = os.path.join('xoxo', 'Lib', 'site-packages')
161 +            wanted = os.path.join('xoxo', sys.lib, 'site-packages')
162              self.assertEqual(dirs[0], wanted)
163          elif (sys.platform == "darwin" and
164              sysconfig.get_config_var("PYTHONFRAMEWORK")):
165 @@ -235,17 +235,17 @@ class HelperFunctionsTests(unittest.Test
166              self.assertEqual(dirs[0], wanted)
167          elif os.sep == '/':
168              # OS X, Linux, FreeBSD, etc
169 -            self.assertEqual(len(dirs), 2)
170 -            wanted = os.path.join('xoxo', 'lib', 'python' + sys.version[:3],
171 +            self.assertEqual(len(dirs), 4)
172 +            wanted = os.path.join('xoxo', sys.lib, 'python' + sys.version[:3],
173                                    'site-packages')
174              self.assertEqual(dirs[0], wanted)
175 -            wanted = os.path.join('xoxo', 'lib', 'site-python')
176 +            wanted = os.path.join('xoxo', sys.lib, 'site-python')
177              self.assertEqual(dirs[1], wanted)
178          else:
179              # other platforms
180              self.assertEqual(len(dirs), 2)
181              self.assertEqual(dirs[0], 'xoxo')
182 -            wanted = os.path.join('xoxo', 'lib', 'site-packages')
183 +            wanted = os.path.join('xoxo', sys.lib, 'site-packages')
184              self.assertEqual(dirs[1], wanted)
185  
186  class PthFile(object):
187 --- Python-2.7.10.orig/Makefile.pre.in  2015-12-02 19:31:01.322061528 +0100
188 +++ Python-2.7.10/Makefile.pre.in       2015-12-02 19:31:20.058862685 +0100
189 @@ -87,6 +87,8 @@
190  
191  # Machine-dependent subdirectories
192  MACHDEP=       @MACHDEP@
193 +LIB=           @LIB@
194 +ARCH=          @ARCH@
195  
196  # Multiarch directory (may be empty)
197  MULTIARCH=     @MULTIARCH@
198 @@ -106,7 +108,7 @@
199  MANDIR=                @mandir@
200  INCLUDEDIR=    @includedir@
201  CONFINCLUDEDIR=        $(exec_prefix)/include
202 -SCRIPTDIR=     $(prefix)/lib
203 +SCRIPTDIR=     $(prefix)/$(LIB)
204  
205  # Detailed destination directories
206  BINLIBDEST=    $(LIBDIR)/python$(VERSION)
207 @@ -639,7 +641,7 @@
208  Python/compile.o Python/symtable.o Python/ast.o: $(GRAMMAR_H) $(AST_H)
209  
210  Python/getplatform.o: $(srcdir)/Python/getplatform.c
211 -               $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
212 +               $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -DARCH='"$(ARCH)"' -DLIB='"$(LIB)"' -o $@ $(srcdir)/Python/getplatform.c
213  
214  Python/importdl.o: $(srcdir)/Python/importdl.c
215                 $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
216 --- Python-2.7.10.orig/Modules/getpath.c        2015-05-23 18:09:20.000000000 +0200
217 +++ Python-2.7.10/Modules/getpath.c     2015-12-02 19:31:20.062196042 +0100
218 @@ -95,6 +95,17 @@
219   extern "C" {
220  #endif
221  
222 +#ifndef LIB_PYTHON
223 +#if defined(__x86_64__) || (defined(__sparc__) && defined(__arch64__)) || defined(__powerpc64__) || defined(__s390x__)
224 +#if defined(__ILP32__)
225 +#define LIB_PYTHON "libx32/python"
226 +#else
227 +#define LIB_PYTHON "lib64/python"
228 +#endif
229 +#else
230 +#define LIB_PYTHON "lib/python"
231 +#endif
232 +#endif
233  
234  #if !defined(PREFIX) || !defined(EXEC_PREFIX) || !defined(VERSION) || !defined(VPATH)
235  #error "PREFIX, EXEC_PREFIX, VERSION, and VPATH must be constant defined"
236 @@ -129,7 +141,7 @@
237  static char exec_prefix[MAXPATHLEN+1];
238  static char progpath[MAXPATHLEN+1];
239  static char *module_search_path = NULL;
240 -static char lib_python[] = "lib/python" VERSION;
241 +static char lib_python[] = LIB_PYTHON VERSION;
242  
243  static void
244  reduce(char *dir)
245 --- Python-2.7.10.orig/Python/getplatform.c     2015-05-23 18:09:24.000000000 +0200
246 +++ Python-2.7.10/Python/getplatform.c  2015-12-02 19:31:20.062196042 +0100
247 @@ -10,3 +10,23 @@
248  {
249         return PLATFORM;
250  }
251 +
252 +#ifndef ARCH
253 +#define ARCH "unknown"
254 +#endif
255 +
256 +const char *
257 +Py_GetArch(void)
258 +{
259 +       return ARCH;
260 +}
261 +
262 +#ifndef LIB
263 +#define LIB "lib"
264 +#endif
265 +
266 +const char *
267 +Py_GetLib(void)
268 +{
269 +       return LIB;
270 +}
271 --- Python-2.7.10.orig/Python/sysmodule.c       2015-05-23 18:09:24.000000000 +0200
272 +++ Python-2.7.10/Python/sysmodule.c    2015-12-02 19:31:20.062196042 +0100
273 @@ -1437,6 +1437,10 @@
274                          PyString_FromString(Py_GetCopyright()));
275      SET_SYS_FROM_STRING("platform",
276                          PyString_FromString(Py_GetPlatform()));
277 +    SET_SYS_FROM_STRING("arch",
278 +                        PyString_FromString(Py_GetArch()));
279 +    SET_SYS_FROM_STRING("lib",
280 +                        PyString_FromString(Py_GetLib()));
281      SET_SYS_FROM_STRING("executable",
282                          PyString_FromString(Py_GetProgramFullPath()));
283      SET_SYS_FROM_STRING("prefix",
284 --- Python-2.7.10.orig/configure.ac     2015-12-02 19:31:01.322061528 +0100
285 +++ Python-2.7.10/configure.ac  2015-12-02 19:31:20.062196042 +0100
286 @@ -739,6 +739,44 @@
287      ;;
288  esac
289  
290 +AC_SUBST(ARCH)
291 +AC_MSG_CHECKING(ARCH)
292 +ARCH=`uname -m`
293 +case $ARCH in
294 +i?86) ARCH=i386;;
295 +esac
296 +AC_MSG_RESULT($ARCH)
297 +
298 +AC_SUBST(LIB)
299 +AC_MSG_CHECKING(LIB)
300 +case $ac_sys_system in
301 +Linux*)
302 +  # Test if the compiler is 64bit
303 +  echo 'int i;' > conftest.$ac_ext
304 +  python_cv_cc_64bit_output=no
305 +  if AC_TRY_EVAL(ac_compile); then
306 +    case `/usr/bin/file conftest.$ac_objext` in
307 +    *"ELF 64"*)
308 +      python_cv_cc_64bit_output=yes
309 +      ;;
310 +    esac
311 +  fi
312 +  rm -rf conftest*
313 +  ;;
314 +esac
315 +
316 +case $ARCH:$python_cv_cc_64bit_output in
317 +powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes)
318 +  LIB="lib64"
319 +  ;;
320 +x86_64:no)
321 +  LIB="libx32"
322 +  ;;
323 +*:*)
324 +  LIB="lib"
325 +  ;;
326 +esac
327 +AC_MSG_RESULT($LIB)
328  
329  AC_SUBST(LIBRARY)
330  AC_MSG_CHECKING(LIBRARY)
331 --- Python-2.7.10.orig/setup.py 2015-12-02 19:31:01.312061456 +0100
332 +++ Python-2.7.10/setup.py      2015-12-02 19:31:20.062196042 +0100
333 @@ -496,6 +496,7 @@
334          except NameError:
335              have_unicode = 0
336  
337 +        libname = sys.lib
338          # lib_dirs and inc_dirs are used to search for files;
339          # if a file is found in one of those directories, it can
340          # be assumed that no additional -I,-L directives are needed.
341 @@ -507,8 +508,7 @@
342                  ):
343                  add_dir_to_list(inc_dirs, d)
344              for d in (
345 -                '/lib64', '/usr/lib64',
346 -                '/lib', '/usr/lib',
347 +                libname, '/usr/'+libname
348                  ):
349                  add_dir_to_list(lib_dirs, d)
350          exts = []
351 @@ -762,11 +762,11 @@
352              elif curses_library:
353                  readline_libs.append(curses_library)
354              elif self.compiler.find_library_file(lib_dirs +
355 -                                                     ['/usr/lib/termcap'],
356 +                                                     ['/usr' + libname + '/termcap'],
357                                                       'termcap'):
358                  readline_libs.append('termcap')
359              exts.append( Extension('readline', ['readline.c'],
360 -                                   library_dirs=['/usr/lib/termcap'],
361 +                                   library_dirs=['/usr' + libname + '/termcap'],
362                                     extra_link_args=readline_extra_link_args,
363                                     libraries=readline_libs) )
364          else:
365 @@ -1925,8 +1925,8 @@
366              added_lib_dirs.append('/usr/openwin/lib')
367          elif os.path.exists('/usr/X11R6/include'):
368              include_dirs.append('/usr/X11R6/include')
369 -            added_lib_dirs.append('/usr/X11R6/lib64')
370 -            added_lib_dirs.append('/usr/X11R6/lib')
371 +            added_lib_dirs.append('/usr/X11R6/'+sys.lib)
372 +            #added_lib_dirs.append('/usr/X11R6/lib')
373          elif os.path.exists('/usr/X11R5/include'):
374              include_dirs.append('/usr/X11R5/include')
375              added_lib_dirs.append('/usr/X11R5/lib')
This page took 0.05906 seconds and 3 git commands to generate.