Package: automake1.10 The current implementation of the AM_PATH_PYTHON passes the unexpanded '${prefix} and ${exec_prefix} to get_python_lib(). The documentation of get_python_lib() says:
If 'prefix' is supplied, use it instead of sys.prefix or sys.exec_prefix -- i.e., ignore 'plat_specific'. IMO the m4 macro assumes that get_python_lib() just passes this and doesn't use the prefix to do anything, which is at least wrong for Debian's python2.6 and python3.1 in experimental, where we determine the name of the site directory depending on the location ('dist-packages' for a prefix of '/usr' or '/usr/local', 'site-packages' for anything else, like custom locations or installations in python-virtualenv). Just passing the unexpanded value, get_python_lib() cannot decide which name to use for the site directory. The idea of this patch is to pass the real prefix, and then replace it again with the unexpanded value, so that the unexpanded value ends up in the automake variables according to the documentation. Afaics this patch doesn't have an effect on any standard python installation, but correctly determines the location of the site directory on Debian. Matthias
--- /usr/share/aclocal-1.10/python.m4.orig 2009-04-10 16:39:16.000000000 +0200 +++ /usr/share/aclocal-1.10/python.m4 2009-04-15 10:41:11.000000000 +0200 @@ -117,8 +117,16 @@ dnl doesn't work. AC_CACHE_CHECK([for $am_display_PYTHON script directory], [am_cv_python_pythondir], - [am_cv_python_pythondir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(0,0,prefix='$PYTHON_PREFIX')" 2>/dev/null || - echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"`]) + [if test "x$prefix" = xNONE + then + py_prefix=$ac_default_prefix + else + py_prefix=$prefix + fi + am_cv_python_pythondir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(0,0,prefix='$py_prefix'))" 2>/dev/null || + echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"` + am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$py_prefix,$PYTHON_PREFIX,"` + ]) AC_SUBST([pythondir], [$am_cv_python_pythondir]) dnl pkgpythondir -- $PACKAGE directory under pythondir. Was @@ -134,8 +142,16 @@ dnl doesn't work. AC_CACHE_CHECK([for $am_display_PYTHON extension module directory], [am_cv_python_pyexecdir], - [am_cv_python_pyexecdir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(1,0,prefix='$PYTHON_EXEC_PREFIX')" 2>/dev/null || - echo "${PYTHON_EXEC_PREFIX}/lib/python${PYTHON_VERSION}/site-packages"`]) + [if test "x$exec_prefix" = xNONE + then + py_exec_prefix=$py_prefix + else + py_exec_prefix=$exec_prefix + fi + am_cv_python_pyexecdir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(1,0,prefix='$py_exec_prefix'))" 2>/dev/null || + echo "$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages"` + am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$py_exec_prefix,$PYTHON_EXEC_PREFIX,"` + ]) AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir]) dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE)