PDA

View Full Version : Python 2.5 is a mess.


GregLee
7th July 2007, 05:50 PM
On x86_64 there are two python2.5 (and python2.4) directories: one in /usr/lib64/ and one in /usr/lib/. The first, as I understand it, is for platform-specific modules (e.g. .so files), and the second for non-platform specific things (e.g. python scripts). But I can't always tell what should go where. I've compiled Python 2.5.1 from the distribution source, and that version is working pretty well, but not perfectly. I've also tried compiling the source rpm for Fedora 7 using rpmbuild and installing the pre-compiled rpm for Fedora 7 (I'm on a Fedora 6 system), and those versions don't work at all, seemingly for the same reason. In the rpm versions, all the Python scripts are put in /usr/lib64/python2.5/, the wrong place. Consequently, Python can't find any of its scripts, and just doesn't work at all.

Also, I've noticed that the configure script for rpm-4.4.2-40.fc7 checks for Python versions 2.2, 2.3, and 2.4, but not 2.5, which suggests that it was never tested with Python 2.5.

Jman
10th July 2007, 02:53 AM
I suggest you have a look at rpm in Fedora cvs, because that has the complete history of when rpm-python switched to 2.5.

I'm curious as to why you need to build it, I have python 2.5 working fine.

The lib64 for the arch dependent modules is to be consistent with Fedora's 64 bit libraries across the board. I don't see how that's the wrong place. Fedora's python package is all set up for this, do a python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)" on a 64 bit box.

distutils and other methods of installing python stuff should continue to work.

GregLee
10th July 2007, 09:19 PM
I'm curious as to why you need to build it, I have python 2.5 working fine.

The lib64 for the arch dependent modules is to be consistent with Fedora's 64 bit libraries across the board. I don't see how that's the wrong place. Fedora's python package is all set up for this, do a python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)" on a 64 bit box.
I don't need to build it, I guess, but I want to build it.

I just evaluated the expression you suggested (I am on a 64-bit box) and got the result "/usr/lib64/python2.5/site-packages", which is the expected result, right? However, python scripts are not arch dependent, so they don't go there. To be clearer, here is a little script adapted from the "configure" in the Gnome nautilus-python package.
#!/bin/sh
PYTHON=python
PYTHON_PREFIX=/usr
PYTHON_EXEC_PREFIX=/usr
#configure:18633: checking for python version
am_cv_python_version=`$PYTHON -c "import sys; print sys.version[:3]"`
#configure:18640: result: 2.5
echo "Python version:$am_cv_python_version"

#configure:18652: checking for python platform
am_cv_python_platform=`$PYTHON -c "import sys; print sys.platform"`
#configure:18659: result: linux2
echo "Python platform:$am_cv_python_platform"

#configure:18666: checking for python script directory
am_cv_python_pythondir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(0,0,prefix='$PYTHON_PREFI X')"`
#configure:18674: result: ${prefix}/lib/python2.5/site-packages
echo "Python directory:$am_cv_python_pythondir"

#configure:18683: checking for python extension module directory
am_cv_python_pyexecdir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(1,0,prefix='$PYTHON_EXEC_ PREFIX')"`
#configure:18691: result: ${exec_prefix}/lib64/python2.5/site-packages
echo "Python execdir:$am_cv_python_pyexecdir"

As indicated in the comments, on my system two different site-packages paths are returned. When I substitute "PYTHON=python2.4" in the script, I get corresponding results: two different paths (but with "2.4" in place of "2.5").