]> git.pld-linux.org Git - packages/python.git/blob - python-multilib.patch
Do not use $prefix/share in default install scheme
[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 17:54:33.560101256 +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 17:54:33.560101256 +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 17:57:40.004593153 +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 17:54:33.560101256 +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 17:59:13.041917804 +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 17:54:33.563434609 +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 diff -durN -x '*~' -x '*.orig' Python-2.7.10.orig/Lib/test/test_site.py Python-2.7.10/Lib/test/test_site.py
151 --- Python-2.7.10.orig/Lib/test/test_site.py    2015-05-23 18:09:12.000000000 +0200
152 +++ Python-2.7.10/Lib/test/test_site.py 2015-12-02 17:54:42.220155116 +0100
153 @@ -226,7 +226,7 @@
154  
155          if sys.platform in ('os2emx', 'riscos'):
156              self.assertEqual(len(dirs), 1)
157 -            wanted = os.path.join('xoxo', 'Lib', 'site-packages')
158 +            wanted = os.path.join('xoxo', sys.lib, 'site-packages')
159              self.assertEqual(dirs[0], wanted)
160          elif (sys.platform == "darwin" and
161              sysconfig.get_config_var("PYTHONFRAMEWORK")):
162 @@ -241,17 +241,17 @@
163              self.assertEqual(dirs[2], wanted)
164          elif os.sep == '/':
165              # OS X non-framwework builds, Linux, FreeBSD, etc
166 -            self.assertEqual(len(dirs), 2)
167 -            wanted = os.path.join('xoxo', 'lib', 'python' + sys.version[:3],
168 +            self.assertEqual(len(dirs), 4)
169 +            wanted = os.path.join('xoxo', sys.lib, 'python' + sys.version[:3],
170                                    'site-packages')
171              self.assertEqual(dirs[0], wanted)
172 -            wanted = os.path.join('xoxo', 'lib', 'site-python')
173 +            wanted = os.path.join('xoxo', sys.lib, 'site-python')
174              self.assertEqual(dirs[1], wanted)
175          else:
176              # other platforms
177              self.assertEqual(len(dirs), 2)
178              self.assertEqual(dirs[0], 'xoxo')
179 -            wanted = os.path.join('xoxo', 'lib', 'site-packages')
180 +            wanted = os.path.join('xoxo', sys.lib, 'site-packages')
181              self.assertEqual(dirs[1], wanted)
182  
183  class PthFile(object):
184 diff -durN -x '*~' -x '*.orig' Python-2.7.10.orig/Makefile.pre.in Python-2.7.10/Makefile.pre.in
185 --- Python-2.7.10.orig/Makefile.pre.in  2015-12-02 17:53:51.063166393 +0100
186 +++ Python-2.7.10/Makefile.pre.in       2015-12-02 17:54:33.560101256 +0100
187 @@ -87,6 +87,8 @@
188  
189  # Machine-dependent subdirectories
190  MACHDEP=       @MACHDEP@
191 +LIB=           @LIB@
192 +ARCH=          @ARCH@
193  
194  # Multiarch directory (may be empty)
195  MULTIARCH=     @MULTIARCH@
196 @@ -106,7 +108,7 @@
197  MANDIR=                @mandir@
198  INCLUDEDIR=    @includedir@
199  CONFINCLUDEDIR=        $(exec_prefix)/include
200 -SCRIPTDIR=     $(prefix)/lib
201 +SCRIPTDIR=     $(prefix)/$(LIB)
202  
203  # Detailed destination directories
204  BINLIBDEST=    $(LIBDIR)/python$(VERSION)
205 @@ -639,7 +641,7 @@
206  Python/compile.o Python/symtable.o Python/ast.o: $(GRAMMAR_H) $(AST_H)
207  
208  Python/getplatform.o: $(srcdir)/Python/getplatform.c
209 -               $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
210 +               $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -DARCH='"$(ARCH)"' -DLIB='"$(LIB)"' -o $@ $(srcdir)/Python/getplatform.c
211  
212  Python/importdl.o: $(srcdir)/Python/importdl.c
213                 $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
214 diff -durN -x '*~' -x '*.orig' Python-2.7.10.orig/Modules/getpath.c Python-2.7.10/Modules/getpath.c
215 --- Python-2.7.10.orig/Modules/getpath.c        2015-05-23 18:09:20.000000000 +0200
216 +++ Python-2.7.10/Modules/getpath.c     2015-12-02 17:54:33.563434609 +0100
217 @@ -116,9 +116,21 @@
218  #define EXEC_PREFIX PREFIX
219  #endif
220  
221 +#ifndef LIB_PYTHON
222 +#if defined(__x86_64__) || (defined(__sparc__) && defined(__arch64__)) || defined(__powerpc64__) || defined(__s390x__)
223 +#if defined(__ILP32__)
224 +#define LIB_PYTHON "libx32/python"
225 +#else
226 +#define LIB_PYTHON "lib64/python"
227 +#endif
228 +#else
229 +#define LIB_PYTHON "lib/python"
230 +#endif
231 +#endif
232 +
233  #ifndef PYTHONPATH
234 -#define PYTHONPATH PREFIX "/lib/python" VERSION ":" \
235 -              EXEC_PREFIX "/lib/python" VERSION "/lib-dynload"
236 +#define PYTHONPATH PREFIX "/" LIB_PYTHON VERSION ":" \
237 +              EXEC_PREFIX "/" LIB_PYTHON VERSION "/lib-dynload:"
238  #endif
239  
240  #ifndef LANDMARK
241 @@ -129,7 +141,7 @@
242  static char exec_prefix[MAXPATHLEN+1];
243  static char progpath[MAXPATHLEN+1];
244  static char *module_search_path = NULL;
245 -static char lib_python[] = "lib/python" VERSION;
246 +static char lib_python[] = LIB_PYTHON VERSION;
247  
248  static void
249  reduce(char *dir)
250 diff -durN -x '*~' -x '*.orig' Python-2.7.10.orig/Python/getplatform.c Python-2.7.10/Python/getplatform.c
251 --- Python-2.7.10.orig/Python/getplatform.c     2015-05-23 18:09:24.000000000 +0200
252 +++ Python-2.7.10/Python/getplatform.c  2015-12-02 17:54:33.563434609 +0100
253 @@ -10,3 +10,23 @@
254  {
255         return PLATFORM;
256  }
257 +
258 +#ifndef ARCH
259 +#define ARCH "unknown"
260 +#endif
261 +
262 +const char *
263 +Py_GetArch(void)
264 +{
265 +       return ARCH;
266 +}
267 +
268 +#ifndef LIB
269 +#define LIB "lib"
270 +#endif
271 +
272 +const char *
273 +Py_GetLib(void)
274 +{
275 +       return LIB;
276 +}
277 diff -durN -x '*~' -x '*.orig' Python-2.7.10.orig/Python/sysmodule.c Python-2.7.10/Python/sysmodule.c
278 --- Python-2.7.10.orig/Python/sysmodule.c       2015-05-23 18:09:24.000000000 +0200
279 +++ Python-2.7.10/Python/sysmodule.c    2015-12-02 17:54:33.563434609 +0100
280 @@ -1437,6 +1437,10 @@
281                          PyString_FromString(Py_GetCopyright()));
282      SET_SYS_FROM_STRING("platform",
283                          PyString_FromString(Py_GetPlatform()));
284 +    SET_SYS_FROM_STRING("arch",
285 +                        PyString_FromString(Py_GetArch()));
286 +    SET_SYS_FROM_STRING("lib",
287 +                        PyString_FromString(Py_GetLib()));
288      SET_SYS_FROM_STRING("executable",
289                          PyString_FromString(Py_GetProgramFullPath()));
290      SET_SYS_FROM_STRING("prefix",
291 diff -durN -x '*~' -x '*.orig' Python-2.7.10.orig/configure.ac Python-2.7.10/configure.ac
292 --- Python-2.7.10.orig/configure.ac     2015-12-02 17:53:51.063166393 +0100
293 +++ Python-2.7.10/configure.ac  2015-12-02 17:54:33.560101256 +0100
294 @@ -739,6 +739,44 @@
295      ;;
296  esac
297  
298 +AC_SUBST(ARCH)
299 +AC_MSG_CHECKING(ARCH)
300 +ARCH=`uname -m`
301 +case $ARCH in
302 +i?86) ARCH=i386;;
303 +esac
304 +AC_MSG_RESULT($ARCH)
305 +
306 +AC_SUBST(LIB)
307 +AC_MSG_CHECKING(LIB)
308 +case $ac_sys_system in
309 +Linux*)
310 +  # Test if the compiler is 64bit
311 +  echo 'int i;' > conftest.$ac_ext
312 +  python_cv_cc_64bit_output=no
313 +  if AC_TRY_EVAL(ac_compile); then
314 +    case `/usr/bin/file conftest.$ac_objext` in
315 +    *"ELF 64"*)
316 +      python_cv_cc_64bit_output=yes
317 +      ;;
318 +    esac
319 +  fi
320 +  rm -rf conftest*
321 +  ;;
322 +esac
323 +
324 +case $ARCH:$python_cv_cc_64bit_output in
325 +powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes)
326 +  LIB="lib64"
327 +  ;;
328 +x86_64:no)
329 +  LIB="libx32"
330 +  ;;
331 +*:*)
332 +  LIB="lib"
333 +  ;;
334 +esac
335 +AC_MSG_RESULT($LIB)
336  
337  AC_SUBST(LIBRARY)
338  AC_MSG_CHECKING(LIBRARY)
339 diff -durN -x '*~' -x '*.orig' Python-2.7.10.orig/setup.py Python-2.7.10/setup.py
340 --- Python-2.7.10.orig/setup.py 2015-12-02 17:53:51.053166330 +0100
341 +++ Python-2.7.10/setup.py      2015-12-02 17:54:33.563434609 +0100
342 @@ -496,6 +496,7 @@
343          except NameError:
344              have_unicode = 0
345  
346 +        libname = sys.lib
347          # lib_dirs and inc_dirs are used to search for files;
348          # if a file is found in one of those directories, it can
349          # be assumed that no additional -I,-L directives are needed.
350 @@ -507,8 +508,7 @@
351                  ):
352                  add_dir_to_list(inc_dirs, d)
353              for d in (
354 -                '/lib64', '/usr/lib64',
355 -                '/lib', '/usr/lib',
356 +                libname, '/usr/'+libname
357                  ):
358                  add_dir_to_list(lib_dirs, d)
359          exts = []
360 @@ -762,11 +762,11 @@
361              elif curses_library:
362                  readline_libs.append(curses_library)
363              elif self.compiler.find_library_file(lib_dirs +
364 -                                                     ['/usr/lib/termcap'],
365 +                                                     ['/usr' + libname + '/termcap'],
366                                                       'termcap'):
367                  readline_libs.append('termcap')
368              exts.append( Extension('readline', ['readline.c'],
369 -                                   library_dirs=['/usr/lib/termcap'],
370 +                                   library_dirs=['/usr' + libname + '/termcap'],
371                                     extra_link_args=readline_extra_link_args,
372                                     libraries=readline_libs) )
373          else:
374 @@ -1925,8 +1925,8 @@
375              added_lib_dirs.append('/usr/openwin/lib')
376          elif os.path.exists('/usr/X11R6/include'):
377              include_dirs.append('/usr/X11R6/include')
378 -            added_lib_dirs.append('/usr/X11R6/lib64')
379 -            added_lib_dirs.append('/usr/X11R6/lib')
380 +            added_lib_dirs.append('/usr/X11R6/'+sys.lib)
381 +            #added_lib_dirs.append('/usr/X11R6/lib')
382          elif os.path.exists('/usr/X11R5/include'):
383              include_dirs.append('/usr/X11R5/include')
384              added_lib_dirs.append('/usr/X11R5/lib')
This page took 0.110772 seconds and 3 git commands to generate.