
On Fri, 15 Apr 2005, M.-A. Lemburg wrote:
All linux x86-64 distributions use lib64 instead of lib for 64 bit libraries. It looks like this code needs to be cleverer.
Patches are welcome :-)
Attached is a patch which allows distutils to find the lib directory on x86-64. It uses sys.path to search for the Makefile. It also changes command/install.py to change platlib to lib64 if lib64 was returned by get_python_lib. It might be a bit messy for distutils of course, but it shouldn't affect non-x86-64 platforms. Opinions? Jeremy -- Jeremy Sanders <jeremy@jeremysanders.net> http://www.jeremysanders.net/ Cambridge, UK Public Key Server PGP Key ID: E1AAE053 --- sysconfig.py~ 2005-03-03 11:08:02.000000000 +0000 +++ sysconfig.py 2005-04-16 12:20:03.499916704 +0100 @@ -99,8 +99,17 @@ prefix = plat_specific and EXEC_PREFIX or PREFIX if os.name == "posix": - libpython = os.path.join(prefix, - "lib", "python" + get_python_version()) + # search for Makefile in path to locate lib directory, in case + # python isn't in /prefix/lib (e.g. /prefix/lib64) + for i in sys.path: + if os.access( os.path.join(i, "config", "Makefile"), os.F_OK ): + libpython = i + break + else: + # Makefile not found in path + libpython = os.path.join(prefix, + "lib", "python" + get_python_version()) + if standard_lib: return libpython else: --- command/install.py~ 2005-01-20 19:14:17.000000000 +0000 +++ command/install.py 2005-04-16 13:12:07.264032376 +0100 @@ -10,6 +10,7 @@ import sys, os, string from types import * +from distutils.sysconfig import get_python_lib from distutils.core import Command from distutils.debug import DEBUG from distutils.sysconfig import get_config_vars @@ -36,17 +37,25 @@ 'data' : '$base', } + +# Normally unix distributions use lib to store python platlib +# However, under x86-64, platlib uses lib64 +unix_platlib = 'lib' +if get_python_lib().find('lib64') != -1: + unix_platlib = 'lib64' + INSTALL_SCHEMES = { 'unix_prefix': { 'purelib': '$base/lib/python$py_version_short/site-packages', - 'platlib': '$platbase/lib/python$py_version_short/site-packages', + 'platlib': + '$platbase/%s/python$py_version_short/site-packages' % unix_platlib, '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/%s/python' % unix_platlib, 'headers': '$base/include/python/$dist_name', 'scripts': '$base/bin', 'data' : '$base',