* Peter O'Gorman wrote on Thu, May 21, 2009 at 03:39:29PM CEST: > Ralf Wildenhues wrote: > > That aims to ensure that if you do > > ./configure --prefix=$HOME/local > > > > as non-root user, you have a chance to actually install your python > > files below $HOME, too, even with the buggy python on that Mac OS X > > release. Similarly with other --prefix values that clearly point > > outside of the normal system root: why should the python files be > > installed in system directories in that case? If that would really > > be desired, then we should probably provide for a straightforward way to > > override the choices done by the macro. (There is such an override now, > > but only at 'make all'/'make install' time, by overriding the related > > make variables. > > Well, they are cache vars, so they can be overridden at configure time > too by doing ./configure ... am_cv_python_pythondir=/Somewhere/good etc. > I don't see the need to add a --with-foo configure option yet.
Good point. > > We could limit this patch to $am_cv_python_platform = darwin, but I'm > > not sure whether that would be necessary at all. > > > > However, I have a few questions to the patch myself: > > > > How come you added that /System/Library* thingy rather than just > > /System*? > > Well, there is nothing below /System except for Library, but yes, > /System* would have the same effect. Note that /System, like /usr is > theoretically a vendor only area. OK. > > What about --prefix=/usr/ and similar variants? The stripping of > > trailing slashes has only been added to Autoconf after 2.63. > > I don't care :) The only people doing ./configure --prefix=/usr should > be Apple engineers anyway. OK, then /usr/ is irrelevant, /usr is enough. > > BTW, would excluding /usr/local even be desirable? Can't there be a > > python hierarchy below /usr/local either? > > Yeah, I wasn't too sure about /usr/local, removing it (because people > may very well have installed newer python there) is probably a good idea. OK. I've pushed this patch now. Thanks again, Ralf 2009-05-23 Peter O'Gorman <pe...@pogma.com> python: do not install in system directories on Darwin 9. On Darwin 9, get_python_lib returns a path below `/Library/Python' regardless of the `prefix' argument it was passed, causing `make install' to target the system directories regardless of `--prefix' argument used. Work around this Darwin bug by ignoring the result of get_python_lib if it points outside of the passed prefix, and the prefix was not a system directory. * m4/python.m4 (AM_PATH_PYTHON): If the prefix does not match the initial portion of the pythondir returned by get_python_lib, then ignore it unless the configured prefix is `/usr' or starts with `/System'. Fixes instmany-python.test failure on Mac OS X 10.5.7. * NEWS: Update. diff --git a/NEWS b/NEWS index fe4a4d9..20d5080 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,16 @@ +New in 1.11.0a: + +Bugs fixed in 1.11.0a: + +* Long standing bugs: + + - On Darwin 9, `pythondir' and `pyexecdir' pointed below `/Library/Python' + even if the `--prefix' argument pointed outside of a system directory. + AM_PATH_PYTHON has been fixed to ignore the value returned from python's + `get_python_lib' function if it points outside the configured prefix, + unless the `--prefix' argument was either `/usr' or below `/System'. + + New in 1.11: * Version requirements: diff --git a/m4/python.m4 b/m4/python.m4 index 239285f..16de9c3 100644 --- a/m4/python.m4 +++ b/m4/python.m4 @@ -128,6 +128,14 @@ python2.1 python2.0]) 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,"` ;; + *) + case $am_py_prefix in + /usr|/System*) ;; + *) + am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages + ;; + esac + ;; esac ]) AC_SUBST([pythondir], [$am_cv_python_pythondir]) @@ -158,6 +166,14 @@ python2.1 python2.0]) 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,"` ;; + *) + case $am_py_exec_prefix in + /usr|/System*) ;; + *) + am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages + ;; + esac + ;; esac ]) AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir])