INN commit: trunk (4 files)
INN Commit
rra at isc.org
Sun Jun 14 11:44:58 UTC 2015
Date: Sunday, June 14, 2015 @ 04:44:57
Author: iulius
Revision: 9899
Python support: use the distutils.sysconfig module at configure time
Drop support for Python 2.1 and before. It will allow to properly search
for the python binary (in m4/python.m4) thanks to the distutils.sysconfig
module which appeared in Python 2.2.0, released in December 2001!
So it is no longer an issue in 2015.
For the record, Python 1.5.2 was currently enough to build INN.
One of the issues fixed is that on several systems, the
/usr/lib/python2.7/config directory does not exist. It can for instance
be /usr/lib/python2.7/config-x86_64-linux-gnu, so the build fails because
"config" is hard-coded in the current way the detection is coded.
see #78
Modified:
trunk/doc/pod/hook-python.pod
trunk/doc/pod/install.pod
trunk/doc/pod/news.pod
trunk/m4/python.m4
-------------------------+
doc/pod/hook-python.pod | 6 ++-
doc/pod/install.pod | 11 +++----
doc/pod/news.pod | 6 +++
m4/python.m4 | 70 +++++++++++++++++++++-------------------------
4 files changed, 48 insertions(+), 45 deletions(-)
Modified: doc/pod/hook-python.pod
===================================================================
--- doc/pod/hook-python.pod 2015-06-14 10:11:06 UTC (rev 9898)
+++ doc/pod/hook-python.pod 2015-06-14 11:44:57 UTC (rev 9899)
@@ -4,8 +4,10 @@
filtering. It is patterned after the Perl and (now obsolete) TCL hooks
previously added by Bob Heiney and Christophe Wolfhugel.
-For this filter to work successfully, you will need to have at least
-S<Python 1.5.2> installed. You can obtain it from L<http://www.python.org/>.
+For this filter to work successfully, you will need to have
+at least S<Python 2.2.0> installed. You can obtain it from
+L<http://www.python.org/>. Please note that S<Python 3.x> is currently
+not supported.
The B<innd> Python interface and the original Python filtering documentation
were written by Greg Andruk (nee Fluffy) <gerglery at usa.net>. The Python
Modified: doc/pod/install.pod
===================================================================
--- doc/pod/install.pod 2015-06-14 10:11:06 UTC (rev 9898)
+++ doc/pod/install.pod 2015-06-14 11:44:57 UTC (rev 9899)
@@ -146,7 +146,7 @@
versions you'll need:
--with-perl Perl 5.004_03 or higher, 5.8.0+ recommended
- --with-python Python 1.5.2 or higher, 2.5.0+ recommended
+ --with-python Python 2.2.0 or higher, 2.5.0+ recommended (3.x versions currently not supported)
--with-bdb Berkeley DB 4.4 or higher, 4.7+ recommended
--with-zlib zlib 1.x or higher
--with-openssl OpenSSL 0.9.6 or higher
@@ -345,11 +345,10 @@
=item B<--with-python>
Enables support for Python, allowing you to install filter and
-authentication scripts written in Python. You will need S<Python 1.5.2> or
-later installed on your system to enable this option. See
-F<doc/hook-python> for all the details. Note that there is an
-incompatibility between INN and S<Python 2.0> when Python is compiled with
-cycle garbage collection; this problem was reported fixed in S<Python 2.1a1>.
+authentication scripts written in Python. You will need S<Python
+2.2.0> or later installed on your system to enable this option.
+See F<doc/hook-python> for all the details. Please note that S<Python
+3.x> is currently not supported.
=item B<--with-innd-port>=PORT
Modified: doc/pod/news.pod
===================================================================
--- doc/pod/news.pod 2015-06-14 10:11:06 UTC (rev 9898)
+++ doc/pod/news.pod 2015-06-14 11:44:57 UTC (rev 9899)
@@ -210,6 +210,12 @@
=item *
+Building INN with Python support now requires the use of S<Python 2.2.0>
+or later as the distutils.sysconfig module used was introduced with
+S<Python 2.2.0>.
+
+=item *
+
The INN test suite driver is now fully synchronized with the upstream
version of the C TAP Harness package maintained by Russ Allbery.
Keeping the INN test suite driver up-to-date will be possible thanks
Modified: m4/python.m4
===================================================================
--- m4/python.m4 2015-06-14 10:11:06 UTC (rev 9898)
+++ m4/python.m4 2015-06-14 11:44:57 UTC (rev 9899)
@@ -4,44 +4,40 @@
dnl Defines INN_ARG_PYTHON, which sets up the --with-python command line
dnl argument and also sets various flags needed for embedded Python if it is
dnl requested.
+dnl
+dnl We use the distutils.sysconfig module shipped with Python 2.2.0 and later
+dnl to find the compiler and linker flags to use to embed Python.
AC_DEFUN([INN_ARG_PYTHON],
[AC_ARG_VAR([PYTHON], [Location of Python interpreter])
-AC_ARG_WITH([python],
+ AC_ARG_WITH([python],
[AS_HELP_STRING([--with-python], [Embedded Python module support [no]])],
- [case $withval in
- yes) DO_PYTHON=DO
- AC_DEFINE(DO_PYTHON, 1,
- [Define to compile in Python module support.])
- ;;
- no) DO_PYTHON=DONT ;;
- *) AC_MSG_ERROR([invalid argument to --with-python]) ;;
- esac],
- DO_PYTHON=DONT)
-
-dnl A better way of doing this rather than grepping through the Makefile would
-dnl be to use distutils.sysconfig, but this module isn't available in older
-dnl versions of Python.
-if test x"$DO_PYTHON" = xDO ; then
- INN_PATH_PROG_ENSURE([PYTHON], [python])
- AC_MSG_CHECKING([for Python linkage])
- py_prefix=`$PYTHON -c 'import sys; print (sys.prefix)'`
- py_ver=`$PYTHON -c 'import sys; print (sys.version[[:3]])'`
- py_libdir="$py_prefix/lib/python$py_ver"
- PYTHON_CPPFLAGS="-I$py_prefix/include/python$py_ver"
- py_linkage=""
- for py_linkpart in LIBS LIBC LIBM LOCALMODLIBS BASEMODLIBS \
- LINKFORSHARED LDFLAGS ; do
- py_linkage="$py_linkage "`grep "^${py_linkpart}=" \
- $py_libdir/config/Makefile \
- | sed -e 's/^.*=//'`
- done
- PYTHON_LIBS="-L$py_libdir/config -lpython$py_ver $py_linkage"
- PYTHON_LIBS=`echo $PYTHON_LIBS | sed -e 's/[ \\t]*/ /g'`
- AC_MSG_RESULT([$py_libdir])
-else
- PYTHON_CPPFLAGS=
- PYTHON_LIBS=
-fi
-AC_SUBST([PYTHON_CPPFLAGS])
-AC_SUBST([PYTHON_LIBS])])
+ [AS_CASE([$withval],
+ [yes], [DO_PYTHON=DO
+ AC_DEFINE([DO_PYTHON], [1],
+ [Define to compile in Python module support.])],
+ [no], [DO_PYTHON=DONT],
+ [AC_MSG_ERROR([invalid argument to --with-python])])],
+ [DO_PYTHON=DONT])
+ AS_IF([test x"$DO_PYTHON" = xDO],
+ [INN_PATH_PROG_ENSURE([PYTHON], [python])
+ AC_MSG_CHECKING([for Python linkage])
+ py_include=`$PYTHON -c 'import distutils.sysconfig; \
+ print(distutils.sysconfig.get_python_inc())'`
+ PYTHON_CPPFLAGS="-I$py_include"
+ py_ver=`$PYTHON -c 'import sys; print(sys.version[[:3]])'`
+ py_libdir=`$PYTHON -c 'import distutils.sysconfig; \
+ print(distutils.sysconfig.get_python_lib(False, True))'`
+ py_linkage=`$PYTHON -c 'import distutils.sysconfig; \
+ print(" ".join(distutils.sysconfig.get_config_vars("LIBS", \
+ "LIBC", "LIBM", "LOCALMODLIBS", "BASEMODLIBS", \
+ "LINKFORSHARED", "LDFLAGS")))'`
+ py_configdir=`$PYTHON -c 'import distutils.sysconfig; \
+ print(distutils.sysconfig.get_config_var("LIBPL"))'`
+ PYTHON_LIBS="-L$py_configdir -lpython$py_ver $py_linkage"
+ PYTHON_LIBS=`echo $PYTHON_LIBS | sed -e 's/[ \\t]*/ /g'`
+ AC_MSG_RESULT([$py_libdir])],
+ [PYTHON_CPPFLAGS=
+ PYTHON_LIBS=])
+ AC_SUBST([PYTHON_CPPFLAGS])
+ AC_SUBST([PYTHON_LIBS])])
More information about the inn-committers
mailing list