Re: ax_python* : adding support for python 3.4
consultit <[email protected]>
| Newsgroups | gmane.comp.sysutils.autoconf.archive-maintainers |
|---|---|
| Message-ID | <[email protected]> |
I attached an updated patch. Il giorno dom, 14/06/2015 alle 10.36 +0200, consultit ha scritto: > I'm a user of ax_python and ax_python_embed macros. > I made (on debian jessie) 3.4 version my default (by adding a custom > alternative). > Then I have had to patch the above macros just to work for my projects. > So it would be nice if support for version 3.4 (and 3.5) could be added > to the overall ax_python* macro family. > > Thanks. > > PS: I attached a patch got from "git diff" on latest source tree.
ax_python-autoconf-archive.patch
(text/x-patch, 4.2 KB)
diff --git a/m4/ax_python.m4 b/m4/ax_python.m4
index ebfb8d6..2b9dd81 100644
--- a/m4/ax_python.m4
+++ b/m4/ax_python.m4
@@ -51,12 +51,12 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
-#serial 14
+#serial 15
AC_DEFUN([AX_PYTHON],
[AC_MSG_CHECKING(for python build information)
AC_MSG_RESULT([])
-for python in python3.3 python3.2 python3.1 python3.0 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python; do
+for python in python3.4 python3.3 python3.2 python3.1 python3.0 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python; do
AC_CHECK_PROGS(PYTHON_BIN, [$python])
ax_python_bin=$PYTHON_BIN
if test x$ax_python_bin != x; then
diff --git a/m4/ax_python_embed.m4 b/m4/ax_python_embed.m4
index 31f3547..5453ca1 100644
--- a/m4/ax_python_embed.m4
+++ b/m4/ax_python_embed.m4
@@ -120,7 +120,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 8
+#serial 10
# AX_PYTHON_DEFAULT( )
# -----------------
@@ -223,19 +223,19 @@ AC_DEFUN([AX_PYTHON_CSPEC],
AC_ARG_VAR( [PYTHON], [Python Executable Path] )
if test -n "$PYTHON"
then
- ax_python_prefix=`${PYTHON} -c "import sys; print sys.prefix"`
+ ax_python_prefix=`${PYTHON} -c "import sys; print(sys.prefix)"`
if test -z "$ax_python_prefix"
then
AC_MSG_ERROR([Python Prefix is not known])
fi
- ax_python_execprefix=`${PYTHON} -c "import sys; print sys.exec_prefix"`
- ax_python_version=`$PYTHON -c "import sys; print sys.version[[:3]]"`
+ ax_python_execprefix=`${PYTHON} -c "import sys; print(sys.exec_prefix)"`
+ ax_python_version=`$PYTHON -c "import sys; print(sys.version[[:3]])"`
ax_python_includespec="-I${ax_python_prefix}/include/python${ax_python_version}"
if test x"$python_prefix" != x"$python_execprefix"; then
ax_python_execspec="-I${ax_python_execprefix}/include/python${ax_python_version}"
ax_python_includespec="${ax_python_includespec} $ax_python_execspec"
fi
- ax_python_ccshared=`${PYTHON} -c "import distutils.sysconfig; print distutils.sysconfig.get_config_var('CFLAGSFORSHARED')"`
+ ax_python_ccshared=`${PYTHON} -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('CFLAGSFORSHARED'))"`
ax_python_cspec="${ax_python_ccshared} ${ax_python_includespec}"
AC_SUBST([PYTHON_CSPEC], [${ax_python_cspec}])
AC_MSG_NOTICE([PYTHON_CSPEC=${ax_python_cspec}])
@@ -305,7 +305,7 @@ else:
if strLibFW and (strLibFW != ""):
strLinkSpec += " -F%s" % (strLibFW)
strLinkSpec += " %s" % (dictConfig.get('LINKFORSHARED'))
-print strLinkSpec
+print(strLinkSpec)
])
AC_SUBST([PYTHON_LSPEC], [${ax_python_output}])
AC_MSG_NOTICE([PYTHON_LSPEC=${ax_python_output}])
@@ -345,8 +345,8 @@ AC_DEFUN([AX_PYTHON_PREFIX],
then
AC_MSG_ERROR([Python Executable Path is not known])
fi
- ax_python_prefix=`${PYTHON} -c "import sys; print sys.prefix"`
- ax_python_execprefix=`${PYTHON} -c "import sys; print sys.exec_prefix"`
+ ax_python_prefix=`${PYTHON} -c "import sys; print(sys.prefix)"`
+ ax_python_execprefix=`${PYTHON} -c "import sys; print(sys.exec_prefix)"`
AC_SUBST([PYTHON_PREFIX], ["${ax_python_prefix}"])
AC_SUBST([PYTHON_EXECPREFIX], ["${ax_python_execprefix}"])
])
@@ -397,12 +397,15 @@ AC_DEFUN([AX_PYTHON_VERSION_CHECK],
then
AC_MSG_CHECKING([whether $PYTHON version >= $1])
AX_PYTHON_RUN([
-import sys, string
+import sys
# split strings by '.' and convert to numeric. Append some zeros
# because we need at least 4 digits for the hex conversion.
-minver = map(int, string.split('$1', '.')) + [[0, 0, 0]]
+# It accepts a string like "X[.Y[.Z]]" with X,Y,Z=digits
+# and [] means optional.
+minver = list(map(int, '$1'.split('.'))) + [0, 0, 0]
+minver[3] = 255
minverhex = 0
-for i in xrange(0, 4): minverhex = (minverhex << 8) + minver[[i]]
+for i in range(0, 4): minverhex = (minverhex << 8) + minver[i]
if sys.hexversion >= minverhex:
sys.exit( 0 )
else: