Let AM_PATH_PYTHON honor python's idea about the site directory.
authorMatthias Klose <doko@ubuntu.com>
Sun, 17 May 2009 09:29:16 +0000 (11:29 +0200)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 17 May 2009 09:37:55 +0000 (11:37 +0200)
* 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.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
ChangeLog
NEWS
THANKS
m4/python.m4

index 7bdeae6..ded0c6a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2009-05-17  Matthias Klose  <doko@ubuntu.com>  (tiny change)
+           Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       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.
+
 2009-05-17  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        Vala: for now, require GNU make.
diff --git a/NEWS b/NEWS
index e806cf6..0389cca 100644 (file)
--- 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/THANKS b/THANKS
index bf2be2d..07b5872 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -213,6 +213,7 @@ Matt Leach          mleach@cygnus.com
 Matthew D. Langston    langston@SLAC.Stanford.EDU
 Matthias Andree                matthias.andree@gmx.de
 Matthias Clasen                clasen@mathematik.uni-freiburg.de
+Matthias Klose         doko@ubuntu.com
 Maxim Sinev            good@goods.ru
 Merijn de Jonge                M.de.Jonge@cwi.nl
 Michael Brantley       Michael-Brantley@deshaw.com
index 3adf87b..239285f 100644 (file)
@@ -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)