SOURCES: python-lib64.patch - dynamic libdir support from mandriva...

glen glen at pld-linux.org
Thu Jan 26 00:58:25 CET 2006


Author: glen                         Date: Wed Jan 25 23:58:24 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- dynamic libdir support from mandriva:
  http://cvs.mandriva.com/cgi-bin/cvsweb.cgi/SPECS/python/Python-2.4.1-lib64.patch

---- Files affected:
SOURCES:
   python-lib64.patch (1.11 -> 1.12) 

---- Diffs:

================================================================
Index: SOURCES/python-lib64.patch
diff -u SOURCES/python-lib64.patch:1.11 SOURCES/python-lib64.patch:1.12
--- SOURCES/python-lib64.patch:1.11	Thu Dec 23 11:00:56 2004
+++ SOURCES/python-lib64.patch	Thu Jan 26 00:58:18 2006
@@ -1,111 +1,302 @@
-diff -Nur Python-2.4.orig/Lib/distutils/command/install.py Python-2.4/Lib/distutils/command/install.py
---- Python-2.4.orig/Lib/distutils/command/install.py	2004-12-23 09:49:49.805802000 +0000
-+++ Python-2.4/Lib/distutils/command/install.py	2004-12-23 09:50:42.787747736 +0000
-@@ -39,14 +39,14 @@
+--- Python-2.4.1/Include/pythonrun.h.lib64	2004-10-07 05:58:06.000000000 +0200
++++ Python-2.4.1/Include/pythonrun.h	2005-10-08 00:18:33.000000000 +0200
+@@ -93,6 +93,8 @@
+ /* In their own files */
+ PyAPI_FUNC(const char *) Py_GetVersion(void);
+ PyAPI_FUNC(const char *) Py_GetPlatform(void);
++PyAPI_FUNC(const char *) Py_GetArch(void);
++PyAPI_FUNC(const char *) Py_GetLib(void);
+ PyAPI_FUNC(const char *) Py_GetCopyright(void);
+ PyAPI_FUNC(const char *) Py_GetCompiler(void);
+ PyAPI_FUNC(const char *) Py_GetBuildInfo(void);
+--- Python-2.4.1/Lib/distutils/tests/test_install.py
++++ Python-2.4.1/Lib/distutils/tests/test_install.py     2006-01-10 21:28:15.000000000 +0100
+@@ -1,6 +1,6 @@
+ """Tests for distutils.command.install."""
+
+-import os
++import os,sys
+ import unittest
+
+ from distutils.command.install import install
+@@ -39,8 +39,9 @@
+             self.assertEqual(got, expected)
+
+         libdir = os.path.join(destination, "lib", "python")
++        platlibdir =  os.path.join(destination, sys.lib, "python")
+         check_path(cmd.install_lib, libdir)
+-        check_path(cmd.install_platlib, libdir)
++        check_path(cmd.install_platlib, platlibdir)
+         check_path(cmd.install_purelib, libdir)
+         check_path(cmd.install_headers,
+         os.path.join(destination, "include", "python", "foopkg"))
+--- Python-2.4.1/Lib/distutils/command/install.py.lib64	2005-01-20 20:15:39.000000000 +0100
++++ Python-2.4.1/Lib/distutils/command/install.py	2005-10-08 00:18:33.000000000 +0200
+@@ -19,6 +19,8 @@
+ from distutils.errors import DistutilsOptionError
+ from glob import glob
+ 
++libname = sys.lib
++
+ if sys.version < "2.2":
+     WINDOWS_SCHEME = {
+         'purelib': '$base',
+@@ -39,14 +41,14 @@
  INSTALL_SCHEMES = {
      'unix_prefix': {
-         'purelib': '$base/share/python$py_version_short/site-packages',
+         'purelib': '$base/lib/python$py_version_short/site-packages',
 -        'platlib': '$platbase/lib/python$py_version_short/site-packages',
-+        'platlib': '$platbase/lib64/python$py_version_short/site-packages',
++        'platlib': '$platbase/'+libname+'/python$py_version_short/site-packages',
          'headers': '$base/include/python$py_version_short/$dist_name',
          'scripts': '$base/bin',
          'data'   : '$base',
          },
      'unix_home': {
-         'purelib': '$base/share/python',
+         'purelib': '$base/lib/python',
 -        'platlib': '$base/lib/python',
-+        'platlib': '$base/lib64/python',
++        'platlib': '$base/'+libname+'/python',
          'headers': '$base/include/python/$dist_name',
          'scripts': '$base/bin',
          'data'   : '$base',
-diff -Nur Python-2.4.orig/Lib/distutils/sysconfig.py Python-2.4/Lib/distutils/sysconfig.py
---- Python-2.4.orig/Lib/distutils/sysconfig.py	2004-12-23 09:49:49.806802000 +0000
-+++ Python-2.4/Lib/distutils/sysconfig.py	2004-12-23 09:50:42.788747584 +0000
-@@ -101,7 +101,7 @@
+--- Python-2.4.1/Lib/distutils/sysconfig.py.lib64	2005-01-07 00:16:03.000000000 +0100
++++ Python-2.4.1/Lib/distutils/sysconfig.py	2005-10-08 00:18:51.000000000 +0200
+@@ -99,8 +99,12 @@
+         prefix = plat_specific and EXEC_PREFIX or PREFIX
+ 
      if os.name == "posix":
-         if plat_specific: 
-             libpython = os.path.join(prefix,
++        if plat_specific:
++            lib = sys.lib
++        else:
++            lib = 'lib'
+         libpython = os.path.join(prefix,
 -                                 "lib", "python" + get_python_version())
-+                                 "lib64", "python" + get_python_version())
++                                 lib, "python" + get_python_version())
+         if standard_lib:
+             return libpython
          else:
-             libpython = os.path.join(prefix,
-                                  "share", "python" + get_python_version())
-diff -Nur Python-2.4.orig/Lib/site.py Python-2.4/Lib/site.py
---- Python-2.4.orig/Lib/site.py	2004-12-23 09:49:49.807801000 +0000
-+++ Python-2.4/Lib/site.py	2004-12-23 09:52:09.563555808 +0000
-@@ -179,10 +179,10 @@
+@@ -188,7 +188,8 @@
+     if python_build:
+         inc_dir = os.curdir
+     else:
+-        inc_dir = get_python_inc(plat_specific=1)
++        prefix = EXEC_PREFIX or PREFIX
++        inc_dir = os.path.join(prefix, "include", "multiarch-" + sys.arch + "-linux", "python" + sys.version[:3])
+     if sys.version < '2.2':
+         config_h = 'config.h'
+     else:
+--- Python-2.4.1/Lib/site.py.lib64	2004-07-20 04:28:28.000000000 +0200
++++ Python-2.4.1/Lib/site.py	2005-10-08 00:18:33.000000000 +0200
+@@ -179,12 +179,18 @@
                  sitedirs = [os.path.join(prefix, "Lib", "site-packages")]
              elif os.sep == '/':
                  sitedirs = [os.path.join(prefix,
 -                                         "lib",
-+                                         "lib64",
++                                         sys.lib,
                                           "python" + sys.version[:3],
                                           "site-packages"),
--		            os.path.join(prefix, "lib", "site-python"),
-+		            os.path.join(prefix, "lib64", "site-python"),
- 			    os.path.join(prefix,
-                                          "share",
-                                          "python" + sys.version[:3],
-@@ -190,7 +190,7 @@
- 			    os.path.join(prefix, "share", "site-python")]
- 
+-                            os.path.join(prefix, "lib", "site-python")]
++                            os.path.join(prefix, sys.lib, "site-python")]
++                if sys.lib != 'lib':
++                    sitedirs.append(os.path.join(prefix,
++                                                 'lib',
++                                                 "python" + sys.version[:3],
++                                                 "site-packages"))
++                    sitedirs.append(os.path.join(prefix, 'lib', "site-python"))
              else:
 -                sitedirs = [prefix, os.path.join(prefix, "lib", "site-packages")]
-+                sitedirs = [prefix, os.path.join(prefix, "lib64", "site-packages")]
++                sitedirs = [prefix, os.path.join(prefix, sys.lib, "site-packages")]
              if sys.platform == 'darwin':
                  # for framework builds *only* we add the standard Apple
                  # locations. Currently only per-user, but /Library and
-diff -Nur Python-2.4.orig/Makefile.pre.in Python-2.4/Makefile.pre.in
---- Python-2.4.orig/Makefile.pre.in	2004-12-23 09:49:49.806802000 +0000
-+++ Python-2.4/Makefile.pre.in	2004-12-23 09:50:42.789747432 +0000
-@@ -79,7 +79,7 @@
- 
- # Expanded directories
- BINDIR=		$(exec_prefix)/bin
--LIBDIR=		$(exec_prefix)/lib
-+LIBDIR=		$(exec_prefix)/lib64
- MANDIR=		@mandir@
- INCLUDEDIR=	@includedir@
- CONFINCLUDEDIR=	$(exec_prefix)/include
-diff -Nur Python-2.4.orig/Modules/getpath.c Python-2.4/Modules/getpath.c
---- Python-2.4.orig/Modules/getpath.c	2004-12-23 09:49:49.807801000 +0000
-+++ Python-2.4/Modules/getpath.c	2004-12-23 09:50:42.790747280 +0000
-@@ -113,7 +113,7 @@
+--- Python-2.4.1/Modules/getpath.c.lib64	2004-08-08 03:00:47.000000000 +0200
++++ Python-2.4.1/Modules/getpath.c	2005-10-08 00:18:33.000000000 +0200
+@@ -111,9 +111,17 @@
+ #define EXEC_PREFIX PREFIX
+ #endif
  
++#ifndef LIB_PYTHON
++#if defined(__x86_64__)
++#define LIB_PYTHON "lib64/python" VERSION
++#else
++#define LIB_PYTHON "lib/python" VERSION
++#endif
++#endif
++
  #ifndef PYTHONPATH
- #define PYTHONPATH PREFIX "/share/python" VERSION ":" \
+-#define PYTHONPATH PREFIX "/lib/python" VERSION ":" \
 -              EXEC_PREFIX "/lib/python" VERSION "/lib-dynload"
-+              EXEC_PREFIX "/lib64/python" VERSION "/lib-dynload"
++#define PYTHONPATH PREFIX "/" LIB_PYTHON ":" \
++              EXEC_PREFIX "/" LIB_PYTHON "/lib-dynload"
  #endif
  
  #ifndef LANDMARK
-@@ -124,7 +124,7 @@
+@@ -124,7 +132,7 @@
  static char exec_prefix[MAXPATHLEN+1];
  static char progpath[MAXPATHLEN+1];
  static char *module_search_path = NULL;
 -static char lib_python[] = "lib/python" VERSION;
-+static char lib_python[] = "lib64/python" VERSION;
- static char share_python[] = "share/python" VERSION;
++static char lib_python[] = LIB_PYTHON;
  
  static void
-@@ -516,7 +516,7 @@
-     }
-     else
-         strncpy(zip_path, PREFIX, MAXPATHLEN);
--    joinpath(zip_path, "lib/python00.zip");
-+    joinpath(zip_path, "lib64/python00.zip");
-     bufsz = strlen(zip_path);	/* Replace "00" with version */
-     zip_path[bufsz - 6] = VERSION[0];
-     zip_path[bufsz - 5] = VERSION[2];
-diff -Nur Python-2.4.orig/setup.py Python-2.4/setup.py
---- Python-2.4.orig/setup.py	2004-12-23 09:49:49.798803000 +0000
-+++ Python-2.4/setup.py	2004-12-23 09:56:00.934382096 +0000
-@@ -239,7 +239,7 @@
- 
-     def detect_modules(self):
-         # Ensure that /usr/local is always used
--        add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
-+        add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib64')
-         add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
+ reduce(char *dir)
+--- Python-2.4.1/Python/getplatform.c.lib64	2000-09-02 01:29:28.000000000 +0200
++++ Python-2.4.1/Python/getplatform.c	2005-10-08 00:18:33.000000000 +0200
+@@ -10,3 +10,23 @@
+ {
+ 	return PLATFORM;
+ }
++
++#ifndef ARCH
++#define ARCH "unknown"
++#endif
++
++const char *
++Py_GetArch(void)
++{
++	return ARCH;
++}
++
++#ifndef LIB
++#define LIB "lib"
++#endif
++
++const char *
++Py_GetLib(void)
++{
++	return LIB;
++}
+--- Python-2.4.1/Python/sysmodule.c.lib64	2005-01-27 19:58:30.000000000 +0100
++++ Python-2.4.1/Python/sysmodule.c	2005-10-08 00:18:33.000000000 +0200
+@@ -1022,6 +1022,12 @@
+ 	PyDict_SetItemString(sysdict, "platform",
+ 			     v = PyString_FromString(Py_GetPlatform()));
+ 	Py_XDECREF(v);
++	PyDict_SetItemString(sysdict, "arch",
++			     v = PyString_FromString(Py_GetArch()));
++	Py_XDECREF(v);
++	PyDict_SetItemString(sysdict, "lib",
++			     v = PyString_FromString(Py_GetLib()));
++	Py_XDECREF(v);
+ 	PyDict_SetItemString(sysdict, "executable",
+ 			     v = PyString_FromString(Py_GetProgramFullPath()));
+ 	Py_XDECREF(v);
+--- Python-2.4.1/configure.in.lib64	2005-03-29 01:23:34.000000000 +0200
++++ Python-2.4.1/configure.in	2005-10-08 00:18:33.000000000 +0200
+@@ -423,6 +423,41 @@
+     ;;
+ esac
+ 
++AC_SUBST(ARCH)
++AC_MSG_CHECKING(ARCH)
++ARCH=`uname -m`
++case $ARCH in
++i?86) ARCH=i386;;
++esac
++AC_MSG_RESULT($ARCH)
++
++AC_SUBST(LIB)
++AC_MSG_CHECKING(LIB)
++case $ac_sys_system in
++Linux*)
++  # Test if the compiler is 64bit
++  echo 'int i;' > conftest.$ac_ext
++  python_cv_cc_64bit_output=no
++  if AC_TRY_EVAL(ac_compile); then
++    case `/usr/bin/file conftest.$ac_objext` in
++    *"ELF 64"*)
++      python_cv_cc_64bit_output=yes
++      ;;
++    esac
++  fi
++  rm -rf conftest*
++  ;;
++esac
++
++case $ARCH:$python_cv_cc_64bit_output in
++powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes)
++  LIB="lib64"
++  ;;
++*:*)
++  LIB="lib"
++  ;;
++esac
++AC_MSG_RESULT($LIB)
+ 
+ AC_SUBST(LIBRARY)
+ AC_MSG_CHECKING(LIBRARY)
+--- Python-2.4.1/Makefile.pre.in.lib64	2005-03-29 01:23:01.000000000 +0200
++++ Python-2.4.1/Makefile.pre.in	2005-10-08 00:18:33.000000000 +0200
+@@ -70,6 +70,8 @@
+ 
+ # Machine-dependent subdirectories
+ MACHDEP=	@MACHDEP@
++LIB=		@LIB@
++ARCH=		@ARCH@
+ 
+ # Install prefix for architecture-independent files
+ prefix=		@prefix@
+@@ -79,11 +81,11 @@
+ 
+ # Expanded directories
+ BINDIR=		$(exec_prefix)/bin
+-LIBDIR=		$(exec_prefix)/lib
++LIBDIR=		$(exec_prefix)/$(LIB)
+ MANDIR=		@mandir@
+ INCLUDEDIR=	@includedir@
+ CONFINCLUDEDIR=	$(exec_prefix)/include
+-SCRIPTDIR=	$(prefix)/lib
++SCRIPTDIR=	$(prefix)/$(LIB)
+ 
+ # Detailed destination directories
+ BINLIBDEST=	$(LIBDIR)/python$(VERSION)
+@@ -458,7 +460,7 @@
+ Python/compile.o Python/symtable.o: $(GRAMMAR_H)
+ 
+ Python/getplatform.o: $(srcdir)/Python/getplatform.c
+-		$(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
++		$(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -DARCH='"$(ARCH)"' -DLIB='"$(LIB)"' -o $@ $(srcdir)/Python/getplatform.c
+ 
+ Python/importdl.o: $(srcdir)/Python/importdl.c
+ 		$(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
+--- Python-2.4.1/setup.py.lib64	2005-10-08 00:18:33.000000000 +0200
++++ Python-2.4.1/setup.py	2005-10-08 00:18:33.000000000 +0200
+@@ -259,12 +259,12 @@
+         except NameError:
+             have_unicode = 0
  
-         # Add paths to popular package managers on OS X/darwin
++        libname = sys.lib
+         # lib_dirs and inc_dirs are used to search for files;
+         # if a file is found in one of those directories, it can
+         # be assumed that no additional -I,-L directives are needed.
+         lib_dirs = self.compiler.library_dirs + [
+-            '/lib64', '/usr/lib64',
+-            '/lib', '/usr/lib',
++            libname, '/usr/'+libname
+             ]
+         inc_dirs = self.compiler.include_dirs + ['/usr/include']
+         exts = []
+@@ -426,11 +426,11 @@
+             elif self.compiler.find_library_file(lib_dirs, 'curses'):
+                 readline_libs.append('curses')
+             elif self.compiler.find_library_file(lib_dirs +
+-                                               ['/usr/lib/termcap'],
++                                               ['/usr/'+libname+'/termcap'],
+                                                'termcap'):
+                 readline_libs.append('termcap')
+             exts.append( Extension('readline', ['readline.c'],
+-                                   library_dirs=['/usr/lib/termcap'],
++                                   library_dirs=['/usr/'+libname+'/termcap'],
+                                    libraries=readline_libs) )
+         if platform not in ['mac']:
+             # crypt module.
+@@ -1017,8 +1017,8 @@
+             added_lib_dirs.append('/usr/openwin/lib')
+         elif os.path.exists('/usr/X11R6/include'):
+             include_dirs.append('/usr/X11R6/include')
+-            added_lib_dirs.append('/usr/X11R6/lib64')
+-            added_lib_dirs.append('/usr/X11R6/lib')
++            added_lib_dirs.append('/usr/X11R6/'+sys.lib)
++            #added_lib_dirs.append('/usr/X11R6/lib')
+         elif os.path.exists('/usr/X11R5/include'):
+             include_dirs.append('/usr/X11R5/include')
+             added_lib_dirs.append('/usr/X11R5/lib')
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/python-lib64.patch?r1=1.11&r2=1.12&f=u



More information about the pld-cvs-commit mailing list