[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AM_PATH_PYTHON should honor python's idea about the site directory
From: |
Ralf Wildenhues |
Subject: |
Re: AM_PATH_PYTHON should honor python's idea about the site directory |
Date: |
Sun, 17 May 2009 11:39:47 +0200 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
tags upstream fixed-upstream
thanks
[ adding automake-patches; see http://bugs.debian.org/524176 ]
Hello Matthias, and sorry for the delay,
* Matthias Klose wrote on Wed, Apr 15, 2009 at 12:17:57PM CEST:
> 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.
IIUC then the dist-packages vs. site-packages thing is not one
distinguished by the second argument to get_python_lib (the
"standard_lib" argument), right? Otherwise, please correct me.
> 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.
The patch looks good to me. There is a minor technical point that you
shouldn't use arbitrary directory names as sed regexes, and temporary
variables should be in the am_* namespace; both fixed in the version of
your patch below. I've added a small NEWS entry, and you to THANKS, and
applied it to git master of Automake (thus will be in 1.11), I'm
probably going to backport to branch-1-10 soon too, unless I hear
complaints.
Thanks!
Ralf
2009-05-17 Matthias Klose <address@hidden> (tiny change)
Ralf Wildenhues <address@hidden>
Let AM_PATH_PYTHON honor python's idea about the site directory.
* m4/python.m4 (AM_PATH_PYTHON): When computing pythondir and
pyexecdir, pass the expanded prefix resp. exec_prefix as `prefix'
to get_python_lib, so python can determine the name of the site
directory depending on the install location. Afterwards, replace
the directory names with the unexpanded values of $PYTHON_PREFIX
resp. $PYTHON_EXEC_PREFIX again, to allow override according to
the documentation. Fixes site directory computation for Debian
and Ubuntu (`dist-packages' for a prefix of `/usr' or `/usr/local',
`site-packages' elsewhere).
* NEWS, THANKS: Update.
diff --git a/NEWS b/NEWS
index e806cf6..0389cca 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@ New in 1.10c:
- There is initial support for the Vala programming language, when using
Vala 0.7.0 or later.
+ - AM_PATH_PYTHON honors python's idea about the site directory.
+
* Miscellaneous Changes:
- In 1.10b, the `parallel-tests' driver introduced per-extension test
diff --git a/m4/python.m4 b/m4/python.m4
index 3adf87b..239285f 100644
--- a/m4/python.m4
+++ b/m4/python.m4
@@ -3,7 +3,7 @@
## From Andrew Dalke
## Updated by James Henstridge
## ------------------------
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
@@ -115,8 +115,21 @@ python2.1 python2.0])
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
+ am_py_prefix=$ac_default_prefix
+ else
+ am_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='$am_py_prefix'))"
2>/dev/null ||
+ echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"`
+ case $am_cv_python_pythondir in
+ $am_py_prefix*)
+ am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'`
+ am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed
"s,^$am__strip_prefix,$PYTHON_PREFIX,"`
+ ;;
+ esac
+ ])
AC_SUBST([pythondir], [$am_cv_python_pythondir])
dnl pkgpythondir -- $PACKAGE directory under pythondir. Was
@@ -132,8 +145,21 @@ python2.1 python2.0])
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
+ am_py_exec_prefix=$am_py_prefix
+ else
+ am_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='$am_py_exec_prefix'))"
2>/dev/null ||
+ echo "$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages"`
+ case $am_cv_python_pyexecdir in
+ $am_py_exec_prefix*)
+ am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'`
+ am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed
"s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"`
+ ;;
+ esac
+ ])
AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir])
dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: AM_PATH_PYTHON should honor python's idea about the site directory,
Ralf Wildenhues <=