]> git.pld-linux.org Git - packages/python.git/blob - python-lib64.patch
- rel 2; keep python2.6 hardlink (we will have to deal with python3.0 soon)
[packages/python.git] / python-lib64.patch
1 diff -Nur Python-2.5b2.orig/configure.in Python-2.5b2/configure.in
2 --- Python-2.5b2.orig/configure.in      2006-07-06 11:13:35.000000000 +0100
3 +++ Python-2.5b2/configure.in   2006-07-12 17:42:51.000000000 +0100
4 @@ -503,6 +503,41 @@
5      ;;
6  esac
7  
8 +AC_SUBST(ARCH)
9 +AC_MSG_CHECKING(ARCH)
10 +ARCH=`uname -m`
11 +case $ARCH in
12 +i?86) ARCH=i386;;
13 +esac
14 +AC_MSG_RESULT($ARCH)
15 +
16 +AC_SUBST(LIB)
17 +AC_MSG_CHECKING(LIB)
18 +case $ac_sys_system in
19 +Linux*)
20 +  # Test if the compiler is 64bit
21 +  echo 'int i;' > conftest.$ac_ext
22 +  python_cv_cc_64bit_output=no
23 +  if AC_TRY_EVAL(ac_compile); then
24 +    case `/usr/bin/file conftest.$ac_objext` in
25 +    *"ELF 64"*)
26 +      python_cv_cc_64bit_output=yes
27 +      ;;
28 +    esac
29 +  fi
30 +  rm -rf conftest*
31 +  ;;
32 +esac
33 +
34 +case $ARCH:$python_cv_cc_64bit_output in
35 +powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes)
36 +  LIB="lib64"
37 +  ;;
38 +*:*)
39 +  LIB="lib"
40 +  ;;
41 +esac
42 +AC_MSG_RESULT($LIB)
43  
44  AC_SUBST(LIBRARY)
45  AC_MSG_CHECKING(LIBRARY)
46 diff -Nur Python-2.5b2.orig/Include/pythonrun.h Python-2.5b2/Include/pythonrun.h
47 --- Python-2.5b2.orig/Include/pythonrun.h       2006-04-03 07:26:32.000000000 +0100
48 +++ Python-2.5b2/Include/pythonrun.h    2006-07-12 17:42:51.000000000 +0100
49 @@ -107,6 +107,8 @@
50  /* In their own files */
51  PyAPI_FUNC(const char *) Py_GetVersion(void);
52  PyAPI_FUNC(const char *) Py_GetPlatform(void);
53 +PyAPI_FUNC(const char *) Py_GetArch(void);
54 +PyAPI_FUNC(const char *) Py_GetLib(void);
55  PyAPI_FUNC(const char *) Py_GetCopyright(void);
56  PyAPI_FUNC(const char *) Py_GetCompiler(void);
57  PyAPI_FUNC(const char *) Py_GetBuildInfo(void);
58 diff -Nur Python-2.5b2.orig/Lib/distutils/command/install.py Python-2.5b2/Lib/distutils/command/install.py
59 --- Python-2.5b2.orig/Lib/distutils/command/install.py  2006-03-27 22:55:21.000000000 +0100
60 +++ Python-2.5b2/Lib/distutils/command/install.py       2006-07-12 17:42:51.000000000 +0100
61 @@ -19,6 +19,8 @@
62  from distutils.errors import DistutilsOptionError
63  from glob import glob
64  
65 +libname = sys.lib
66 +
67  if sys.version < "2.2":
68      WINDOWS_SCHEME = {
69          'purelib': '$base',
70 @@ -39,14 +41,14 @@
71  INSTALL_SCHEMES = {
72      'unix_prefix': {
73          'purelib': '$base/lib/python$py_version_short/site-packages',
74 -        'platlib': '$platbase/lib/python$py_version_short/site-packages',
75 +        'platlib': '$platbase/'+libname+'/python$py_version_short/site-packages',
76          'headers': '$base/include/python$py_version_short/$dist_name',
77          'scripts': '$base/bin',
78          'data'   : '$base',
79          },
80      'unix_home': {
81          'purelib': '$base/lib/python',
82 -        'platlib': '$base/lib/python',
83 +        'platlib': '$base/'+libname+'/python',
84          'headers': '$base/include/python/$dist_name',
85          'scripts': '$base/bin',
86          'data'   : '$base',
87 diff -Nur Python-2.5b2.orig/Lib/distutils/sysconfig.py Python-2.5b2/Lib/distutils/sysconfig.py
88 --- Python-2.5b2.orig/Lib/distutils/sysconfig.py        2006-06-27 11:08:25.000000000 +0100
89 +++ Python-2.5b2/Lib/distutils/sysconfig.py     2006-07-12 17:42:51.000000000 +0100
90 @@ -99,8 +99,12 @@
91          prefix = plat_specific and EXEC_PREFIX or PREFIX
92  
93      if os.name == "posix":
94 +        if plat_specific:
95 +            lib = sys.lib
96 +        else:
97 +            lib = 'lib'
98          libpython = os.path.join(prefix,
99 -                                 "lib", "python" + get_python_version())
100 +                                 lib, "python" + get_python_version())
101          if standard_lib:
102              return libpython
103          else:
104 diff -Nur Python-2.5b2.orig/Lib/distutils/tests/test_install.py Python-2.5b2/Lib/distutils/tests/test_install.py
105 --- Python-2.5b2.orig/Lib/distutils/tests/test_install.py       2004-06-26 00:02:59.000000000 +0100
106 +++ Python-2.5b2/Lib/distutils/tests/test_install.py    2006-07-12 17:42:51.000000000 +0100
107 @@ -1,6 +1,6 @@
108  """Tests for distutils.command.install."""
109  
110 -import os
111 +import os,sys
112  import unittest
113  
114  from distutils.command.install import install
115 @@ -39,8 +39,9 @@
116              self.assertEqual(got, expected)
117  
118          libdir = os.path.join(destination, "lib", "python")
119 +        platlibdir =  os.path.join(destination, sys.lib, "python")
120          check_path(cmd.install_lib, libdir)
121 -        check_path(cmd.install_platlib, libdir)
122 +        check_path(cmd.install_platlib, platlibdir)
123          check_path(cmd.install_purelib, libdir)
124          check_path(cmd.install_headers,
125                     os.path.join(destination, "include", "python", "foopkg"))
126 diff -Nur Python-2.5b2.orig/Lib/site.py Python-2.5b2/Lib/site.py
127 --- Python-2.5b2.orig/Lib/site.py       2006-06-12 09:23:02.000000000 +0100
128 +++ Python-2.5b2/Lib/site.py    2006-07-12 17:42:51.000000000 +0100
129 @@ -265,13 +265,20 @@
130          if sys.platform in ('os2emx', 'riscos'):
131              sitedirs.append(os.path.join(prefix, "Lib", "site-packages"))
132          elif os.sep == '/':
133 -            sitedirs.append(os.path.join(prefix, "lib",
134 +            sitedirs.append(os.path.join(prefix, sys.lib,
135                                          "python" + sys.version[:3],
136                                          "site-packages"))
137 -            sitedirs.append(os.path.join(prefix, "lib", "site-python"))
138 +            sitedirs.append(os.path.join(prefix, sys.lib, "site-python"))
139 +            if sys.lib != 'lib':
140 +                sitedirs.append(os.path.join(prefix,
141 +                    'lib',
142 +                    "python" + sys.version[:3],
143 +                    "site-packages"))
144 +                sitedirs.append(os.path.join(prefix, 'lib', "site-python"))
145 +
146          else:
147              sitedirs.append(prefix)
148 -            sitedirs.append(os.path.join(prefix, "lib", "site-packages"))
149 +            sitedirs.append(os.path.join(prefix, sys.lib, "site-packages"))
150  
151          if sys.platform == "darwin":
152              # for framework builds *only* we add the standard Apple
153 diff -Nur Python-2.5b2.orig/Makefile.pre.in Python-2.5b2/Makefile.pre.in
154 --- Python-2.5b2.orig/Makefile.pre.in   2006-06-27 16:45:32.000000000 +0100
155 +++ Python-2.5b2/Makefile.pre.in        2006-07-12 17:42:51.000000000 +0100
156 @@ -75,6 +75,8 @@
157  
158  # Machine-dependent subdirectories
159  MACHDEP=       @MACHDEP@
160 +LIB=           @LIB@
161 +ARCH=          @ARCH@
162  
163  # Install prefix for architecture-independent files
164  prefix=                @prefix@
165 @@ -84,11 +86,11 @@
166  
167  # Expanded directories
168  BINDIR=                $(exec_prefix)/bin
169 -LIBDIR=                $(exec_prefix)/lib
170 +LIBDIR=                $(exec_prefix)/$(LIB)
171  MANDIR=                @mandir@
172  INCLUDEDIR=    @includedir@
173  CONFINCLUDEDIR=        $(exec_prefix)/include
174 -SCRIPTDIR=     $(prefix)/lib
175 +SCRIPTDIR=     $(prefix)/$(LIB)
176  
177  # Detailed destination directories
178  BINLIBDEST=    $(LIBDIR)/python$(VERSION)
179 @@ -489,7 +491,7 @@
180  Python/compile.o Python/symtable.o: $(GRAMMAR_H) $(AST_H)
181  
182  Python/getplatform.o: $(srcdir)/Python/getplatform.c
183 -               $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
184 +               $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -DARCH='"$(ARCH)"' -DLIB='"$(LIB)"' -o $@ $(srcdir)/Python/getplatform.c
185  
186  Python/importdl.o: $(srcdir)/Python/importdl.c
187                 $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
188 diff -Nur Python-2.5b2.orig/Modules/getpath.c Python-2.5b2/Modules/getpath.c
189 --- Python-2.5b2.orig/Modules/getpath.c 2006-07-10 02:18:57.000000000 +0100
190 +++ Python-2.5b2/Modules/getpath.c      2006-07-12 17:42:51.000000000 +0100
191 @@ -116,9 +116,17 @@
192  #define EXEC_PREFIX PREFIX
193  #endif
194  
195 +#ifndef LIB_PYTHON
196 +#if defined(__x86_64__) || (defined(__sparc__) && defined(__arch64__)) || defined(__powerpc64__) || defined(__s390x__)
197 +#define LIB_PYTHON "lib64/python"
198 +#else
199 +#define LIB_PYTHON "lib/python"
200 +#endif
201 +#endif
202 +
203  #ifndef PYTHONPATH
204 -#define PYTHONPATH PREFIX "/lib/python" VERSION ":" \
205 -              EXEC_PREFIX "/lib/python" VERSION "/lib-dynload"
206 +#define PYTHONPATH PREFIX "/" LIB_PYTHON VERSION ":" \
207 +              EXEC_PREFIX "/" LIB_PYTHON VERSION "/lib-dynload:"
208  #endif
209  
210  #ifndef LANDMARK
211 @@ -129,7 +137,7 @@
212  static char exec_prefix[MAXPATHLEN+1];
213  static char progpath[MAXPATHLEN+1];
214  static char *module_search_path = NULL;
215 -static char lib_python[] = "lib/python" VERSION;
216 +static char lib_python[] = LIB_PYTHON VERSION;
217  
218  static void
219  reduce(char *dir)
220 diff -Nur Python-2.5b2.orig/Python/getplatform.c Python-2.5b2/Python/getplatform.c
221 --- Python-2.5b2.orig/Python/getplatform.c      2000-09-02 00:29:29.000000000 +0100
222 +++ Python-2.5b2/Python/getplatform.c   2006-07-12 17:42:51.000000000 +0100
223 @@ -10,3 +10,23 @@
224  {
225         return PLATFORM;
226  }
227 +
228 +#ifndef ARCH
229 +#define ARCH "unknown"
230 +#endif
231 +
232 +const char *
233 +Py_GetArch(void)
234 +{
235 +       return ARCH;
236 +}
237 +
238 +#ifndef LIB
239 +#define LIB "lib"
240 +#endif
241 +
242 +const char *
243 +Py_GetLib(void)
244 +{
245 +       return LIB;
246 +}
247 diff -Nur Python-2.5b2.orig/Python/sysmodule.c Python-2.5b2/Python/sysmodule.c
248 --- Python-2.5b2.orig/Python/sysmodule.c        2006-07-10 22:08:24.000000000 +0100
249 +++ Python-2.5b2/Python/sysmodule.c     2006-07-12 17:42:51.000000000 +0100
250 @@ -1377,6 +1377,10 @@
251                             PyString_FromString(Py_GetCopyright()));
252         SET_SYS_FROM_STRING("platform",
253                             PyString_FromString(Py_GetPlatform()));
254 +       SET_SYS_FROM_STRING("arch",
255 +                           PyString_FromString(Py_GetArch()));
256 +       SET_SYS_FROM_STRING("lib",
257 +                           PyString_FromString(Py_GetLib()));
258         SET_SYS_FROM_STRING("executable",
259                             PyString_FromString(Py_GetProgramFullPath()));
260         SET_SYS_FROM_STRING("prefix",
261 diff -Nur Python-2.5b2.orig/setup.py Python-2.5b2/setup.py
262 --- Python-2.5b2.orig/setup.py  2006-06-30 07:18:39.000000000 +0100
263 +++ Python-2.5b2/setup.py       2006-07-12 17:45:14.000000000 +0100
264 @@ -290,12 +290,12 @@
265          except NameError:
266              have_unicode = 0
267  
268 +        libname = sys.lib
269          # lib_dirs and inc_dirs are used to search for files;
270          # if a file is found in one of those directories, it can
271          # be assumed that no additional -I,-L directives are needed.
272          lib_dirs = self.compiler.library_dirs + [
273 -            '/lib64', '/usr/lib64',
274 -            '/lib', '/usr/lib',
275 +            libname, '/usr/'+libname
276              ]
277          inc_dirs = self.compiler.include_dirs + ['/usr/include']
278          exts = []
279 @@ -496,11 +496,11 @@
280              elif self.compiler.find_library_file(lib_dirs, 'curses'):
281                  readline_libs.append('curses')
282              elif self.compiler.find_library_file(lib_dirs +
283 -                                               ['/usr/lib/termcap'],
284 +                                               ['/usr' + libname + '/termcap'],
285                                                 'termcap'):
286                  readline_libs.append('termcap')
287              exts.append( Extension('readline', ['readline.c'],
288 -                                   library_dirs=['/usr/lib/termcap'],
289 +                                   library_dirs=['/usr' + libname + 'termcap'],
290                                     extra_link_args=readline_extra_link_args,
291                                     libraries=readline_libs) )
292          if platform not in ['mac']:
293 @@ -1244,8 +1244,8 @@
294              added_lib_dirs.append('/usr/openwin/lib')
295          elif os.path.exists('/usr/X11R6/include'):
296              include_dirs.append('/usr/X11R6/include')
297 -            added_lib_dirs.append('/usr/X11R6/lib64')
298 -            added_lib_dirs.append('/usr/X11R6/lib')
299 +            added_lib_dirs.append('/usr/X11R6/'+sys.lib)
300 +            #added_lib_dirs.append('/usr/X11R6/lib')
301          elif os.path.exists('/usr/X11R5/include'):
302              include_dirs.append('/usr/X11R5/include')
303              added_lib_dirs.append('/usr/X11R5/lib')
This page took 0.043984 seconds and 3 git commands to generate.