[Distutils] bdist_rpm and bdist on x86-64

Jeremy Sanders jeremy at jeremysanders.net
Fri Apr 15 21:55:05 CEST 2005


On Fri, 15 Apr 2005, M.-A. Lemburg wrote:

> Check the Makefile you Python version has installed in
> lib/pythonX.X/config/Makefile

There is no /usr/lib/python2.3/config/Makefile. It is installed in 
/usr/lib64/python2.3/config/Makefile.

That file contains

# Expanded directories
BINDIR=         $(exec_prefix)/bin
LIBDIR=         $(exec_prefix)/lib64
MANDIR=         /usr/share/man
INCLUDEDIR=     /usr/include
CONFINCLUDEDIR= $(exec_prefix)/include
SCRIPTDIR=      $(prefix)/lib64

# Detailed destination directories
BINLIBDEST=     $(LIBDIR)/python$(VERSION)
LIBDEST=        $(SCRIPTDIR)/python$(VERSION)
INCLUDEPY=      $(INCLUDEDIR)/python$(VERSION)
CONFINCLUDEPY=  $(CONFINCLUDEDIR)/python$(VERSION)
LIBP=           $(LIBDIR)/python$(VERSION)

So it looks like distutils is looking in the wrong place.

If you look in sysconfig.py:

def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
     """Return the directory containing the Python library (standard or
     site additions).

     If 'plat_specific' is true, return the directory containing
     platform-specific modules, i.e. any module from a non-pure-Python
     module distribution; otherwise, return the platform-shared library
     directory.  If 'standard_lib' is true, return the directory
     containing standard Python library modules; otherwise, return the
     directory for site-specific modules.

     If 'prefix' is supplied, use it instead of sys.prefix or
     sys.exec_prefix -- i.e., ignore 'plat_specific'.
     """
     if prefix is None:
         prefix = plat_specific and EXEC_PREFIX or PREFIX

     if os.name == "posix":
         libpython = os.path.join(prefix,
                                  "lib", "python" + get_python_version())
         if standard_lib:
             return libpython
         else:
             return os.path.join(libpython, "site-packages")

     elif os.name == "nt":
         if standard_lib:
             return os.path.join(prefix, "Lib")
         else:
             if get_python_version() < "2.2":
                 return prefix
             else:
                 return os.path.join(PREFIX, "Lib", "site-packages")

     elif os.name == "mac":
         if plat_specific:
             if standard_lib:
                 return os.path.join(prefix, "Lib", "lib-dynload")
             else:
                 return os.path.join(prefix, "Lib", "site-packages")
         else:
             if standard_lib:
                 return os.path.join(prefix, "Lib")
             else:
                 return os.path.join(prefix, "Lib", "site-packages")

     elif os.name == "os2":
         if standard_lib:
             return os.path.join(PREFIX, "Lib")
         else:
             return os.path.join(PREFIX, "Lib", "site-packages")

     else:
         raise DistutilsPlatformError(
             "I don't know where Python installs its library "
             "on platform '%s'" % os.name)


Under the posix section, distutils assumes that Python is installed in 
/usr/lib/python-X.X, where it's really in /usr/lib64/python-X.X. This is 
clearly a distutils bug. Distutils should be looking under lib64 for 
64-bit x86 systems.

All linux x86-64 distributions use lib64 instead of lib for 64 bit 
libraries. It looks like this code needs to be cleverer.

Jeremy

-- 
Jeremy Sanders <jeremy at jeremysanders.net>
http://www.jeremysanders.net/                Cambridge, UK
Public Key Server PGP Key ID: E1AAE053


More information about the Distutils-SIG mailing list