Submitted By: Jim Gifford (jim at linuxfromscratch dot org)
Date: 2006-01-06
Initial Package Version: 2.4.2
Origin: Jim Gifford
Description: Makes changes so we can fix the lib directories
             for multilib builds with the following sed.

sed -i -e "s:@@MULTILIB_DIR@@:lib64:g" \
        Lib/distutils/command/install.py \
        Lib/distutils/sysconfig.py \
        Lib/site.py \
        Makefile.pre.in \
        Modules/Setup.dist \
        Modules/getpath.c \
        setup.py


diff -Naur Python-2.4.2.orig/Lib/distutils/command/install.py Python-2.4.2/Lib/distutils/command/install.py
--- Python-2.4.2.orig/Lib/distutils/command/install.py	2005-01-20 11:15:39 -0800
+++ Python-2.4.2/Lib/distutils/command/install.py	2006-01-06 15:47:38 -0800
@@ -39,14 +39,14 @@
 INSTALL_SCHEMES = {
     'unix_prefix': {
         'purelib': '$base/lib/python$py_version_short/site-packages',
-        'platlib': '$platbase/lib/python$py_version_short/site-packages',
+        'platlib': '$platbase/@@MULTILIB_DIR@@/python$py_version_short/site-packages',
         'headers': '$base/include/python$py_version_short/$dist_name',
         'scripts': '$base/bin',
         'data'   : '$base',
         },
     'unix_home': {
         'purelib': '$base/lib/python',
-        'platlib': '$base/lib/python',
+        'platlib': '$base/@@MULTILIB_DIR@@/python',
         'headers': '$base/include/python/$dist_name',
         'scripts': '$base/bin',
         'data'   : '$base',
diff -Naur Python-2.4.2.orig/Lib/distutils/sysconfig.py Python-2.4.2/Lib/distutils/sysconfig.py
--- Python-2.4.2.orig/Lib/distutils/sysconfig.py	2005-01-06 15:16:03 -0800
+++ Python-2.4.2/Lib/distutils/sysconfig.py	2006-01-06 15:47:38 -0800
@@ -99,8 +99,12 @@
         prefix = plat_specific and EXEC_PREFIX or PREFIX
 
     if os.name == "posix":
+        if plat_specific:
+            lib = "@@MULTILIB_DIR@@"
+        else:
+            lib = "lib"
         libpython = os.path.join(prefix,
-                                 "lib", "python" + get_python_version())
+                                 lib, "python" + get_python_version())
         if standard_lib:
             return libpython
         else:
diff -Naur Python-2.4.2.orig/Lib/site.py Python-2.4.2/Lib/site.py
--- Python-2.4.2.orig/Lib/site.py	2004-07-19 19:28:28 -0700
+++ Python-2.4.2/Lib/site.py	2006-01-06 15:49:19 -0800
@@ -179,12 +179,12 @@
                 sitedirs = [os.path.join(prefix, "Lib", "site-packages")]
             elif os.sep == '/':
                 sitedirs = [os.path.join(prefix,
-                                         "lib",
+                                         "@@MULTILIB_DIR@@",
                                          "python" + sys.version[:3],
                                          "site-packages"),
-                            os.path.join(prefix, "lib", "site-python")]
+                            os.path.join(prefix, "@@MULTILIB_DIR@@", "site-python")]
             else:
-                sitedirs = [prefix, os.path.join(prefix, "lib", "site-packages")]
+                sitedirs = [prefix, os.path.join(prefix, "@@MULTILIB_DIR@@", "site-packages")]
             if sys.platform == 'darwin':
                 # for framework builds *only* we add the standard Apple
                 # locations. Currently only per-user, but /Library and
diff -Naur Python-2.4.2.orig/Makefile.pre.in Python-2.4.2/Makefile.pre.in
--- Python-2.4.2.orig/Makefile.pre.in	2005-03-28 15:23:01 -0800
+++ Python-2.4.2/Makefile.pre.in	2006-01-06 15:47:38 -0800
@@ -79,7 +79,7 @@
 
 # Expanded directories
 BINDIR=		$(exec_prefix)/bin
-LIBDIR=		$(exec_prefix)/lib
+LIBDIR=		$(exec_prefix)/@@MULTILIB_DIR@@
 MANDIR=		@mandir@
 INCLUDEDIR=	@includedir@
 CONFINCLUDEDIR=	$(exec_prefix)/include
diff -Naur Python-2.4.2.orig/Modules/Setup.dist Python-2.4.2/Modules/Setup.dist
--- Python-2.4.2.orig/Modules/Setup.dist	2005-03-09 15:47:44 -0800
+++ Python-2.4.2/Modules/Setup.dist	2006-01-06 15:47:38 -0800
@@ -329,7 +329,7 @@
 # *** Uncomment and edit to reflect your Tcl/Tk versions:
 #	-ltk8.2 -ltcl8.2 \
 # *** Uncomment and edit to reflect where your X11 libraries are:
-#	-L/usr/X11R6/lib \
+# 	-L/usr/X11R6/lib \
 # *** Or uncomment this for Solaris:
 #	-L/usr/openwin/lib \
 # *** Uncomment these for TOGL extension only:
@@ -400,7 +400,7 @@
 #DB=/usr/local/BerkeleyDB.4.0
 #DBLIBVER=4.0
 #DBINC=$(DB)/include
-#DBLIB=$(DB)/lib
+DBLIB=$(DB)/@@MULTILIB_DIR@@
 #_bsddb _bsddb.c -I$(DBINC) -L$(DBLIB) -ldb-$(DBLIBVER)
 
 # Historical Berkeley DB 1.85
@@ -446,7 +446,7 @@
 # Andrew Kuchling's zlib module.
 # This require zlib 1.1.3 (or later).
 # See http://www.gzip.org/zlib/
-#zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
+#zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/@@MULTILIB_DIR@@ -lz
 
 # Interface to the Expat XML parser
 #
diff -Naur Python-2.4.2.orig/Modules/getpath.c Python-2.4.2/Modules/getpath.c
--- Python-2.4.2.orig/Modules/getpath.c	2004-08-07 18:00:47 -0700
+++ Python-2.4.2/Modules/getpath.c	2006-01-06 15:47:38 -0800
@@ -113,7 +113,7 @@
 
 #ifndef PYTHONPATH
 #define PYTHONPATH PREFIX "/lib/python" VERSION ":" \
-              EXEC_PREFIX "/lib/python" VERSION "/lib-dynload"
+              EXEC_PREFIX "/@@MULTILIB_DIR@@/python" VERSION "/lib-dynload"
 #endif
 
 #ifndef LANDMARK
@@ -125,6 +125,7 @@
 static char progpath[MAXPATHLEN+1];
 static char *module_search_path = NULL;
 static char lib_python[] = "lib/python" VERSION;
+static char lib_exec_python[] = "@@MULTILIB_DIR@@/python" VERSION;
 
 static void
 reduce(char *dir)
@@ -321,7 +322,7 @@
             strncpy(exec_prefix, delim+1, MAXPATHLEN);
         else
             strncpy(exec_prefix, home, MAXPATHLEN);
-        joinpath(exec_prefix, lib_python);
+        joinpath(exec_prefix, lib_exec_python);
         joinpath(exec_prefix, "lib-dynload");
         return 1;
     }
@@ -338,7 +339,7 @@
     copy_absolute(exec_prefix, argv0_path);
     do {
         n = strlen(exec_prefix);
-        joinpath(exec_prefix, lib_python);
+        joinpath(exec_prefix, lib_exec_python);
         joinpath(exec_prefix, "lib-dynload");
         if (isdir(exec_prefix))
             return 1;
@@ -348,7 +349,7 @@
 
     /* Look at configure's EXEC_PREFIX */
     strncpy(exec_prefix, EXEC_PREFIX, MAXPATHLEN);
-    joinpath(exec_prefix, lib_python);
+    joinpath(exec_prefix, lib_exec_python);
     joinpath(exec_prefix, "lib-dynload");
     if (isdir(exec_prefix))
         return 1;
@@ -525,7 +526,7 @@
             fprintf(stderr,
                 "Could not find platform dependent libraries <exec_prefix>\n");
         strncpy(exec_prefix, EXEC_PREFIX, MAXPATHLEN);
-        joinpath(exec_prefix, "lib/lib-dynload");
+        joinpath(exec_prefix, "@@MULTILIB_DIR@@/lib-dynload");
     }
     /* If we found EXEC_PREFIX do *not* reduce it!  (Yet.) */
 
diff -Naur Python-2.4.2.orig/setup.py Python-2.4.2/setup.py
--- Python-2.4.2.orig/setup.py	2005-03-09 14:27:24 -0800
+++ Python-2.4.2/setup.py	2006-01-06 15:47:38 -0800
@@ -266,7 +266,7 @@
         # 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',
+            '/@@MULTILIB_DIR@@', '/usr/@@MULTILIB_DIR@@',
             '/lib', '/usr/lib',
             ]
         inc_dirs = self.compiler.include_dirs + ['/usr/include']
@@ -429,11 +429,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/@@MULTILIB_DIR@@/termcap'],
                                                'termcap'):
                 readline_libs.append('termcap')
             exts.append( Extension('readline', ['readline.c'],
-                                   library_dirs=['/usr/lib/termcap'],
+                                   library_dirs=['/usr/@@MULTILIB_DIR@@/termcap'],
                                    libraries=readline_libs) )
         if platform not in ['mac']:
             # crypt module.
@@ -1020,7 +1020,7 @@
             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/@@MULTILIB_DIR@@')
             added_lib_dirs.append('/usr/X11R6/lib')
         elif os.path.exists('/usr/X11R5/include'):
             include_dirs.append('/usr/X11R5/include')
