[Rivet-svn] rivet: Python 3 compatibility

Rivet Mercurial rivet at projects.hepforge.org
Fri Nov 17 10:15:01 GMT 2017


details:   https://rivet.hepforge.org/hg/rivet/rev/36c940079808
branches:  
changeset: 6144:36c940079808
user:      David Grellscheid <david.grellscheid at durham.ac.uk>
date:      Fri Nov 17 10:08:02 2017 +0000
description:
Python 3 compatibility

diffs (truncated from 85 to 50 lines):

--- a/configure.ac	Fri Nov 17 01:23:06 2017 +0000
+++ b/configure.ac	Fri Nov 17 10:08:02 2017 +0000
@@ -197,7 +197,8 @@
 if test x$enable_pyext == xyes; then
   AX_PYTHON_DEVEL([>= '2.6'])
   AC_SUBST(PYTHON_VERSION)
-  RIVET_PYTHONPATH=`$PYTHON -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(prefix='$prefix', plat_specific=True);"`
+  RIVET_PYTHONPATH=`$PYTHON -c "from __future__ import print_function;
+import distutils.sysconfig; print(distutils.sysconfig.get_python_lib(prefix='$prefix', plat_specific=True));"`
   AC_SUBST(RIVET_PYTHONPATH)
   if test -z "$PYTHON"; then
     AC_MSG_ERROR([Can't build Python extension since python can't be found])
@@ -215,7 +216,8 @@
 dnl this helps the test scripts to find them locally instead of
 dnl having to install first
 dnl
-RIVET_SETUP_PY_PATH=$(${PYTHON} -c 'import distutils.util as u, sys; vi=sys.version_info; print "lib.%s-%s.%s" % (u.get_platform(),vi.major, vi.minor)')
+RIVET_SETUP_PY_PATH=$(${PYTHON} -c 'from __future__ import print_function;
+import distutils.util as u, sys; vi=sys.version_info; print("lib.%s-%s.%s" % (u.get_platform(),vi.major, vi.minor))')
 AC_SUBST(RIVET_SETUP_PY_PATH)
 
 
--- a/m4/ax_python_devel.m4	Fri Nov 17 01:23:06 2017 +0000
+++ b/m4/ax_python_devel.m4	Fri Nov 17 10:08:02 2017 +0000
@@ -262,11 +262,11 @@
 	# libraries which must be linked in when embedding
 	#
 	AC_MSG_CHECKING(python extra libraries)
-	if test -z "$PYTHON_EXTRA_LDFLAGS"; then
-	   PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \
-                conf = distutils.sysconfig.get_config_var; \
-                print (conf('LIBS') + ' ' + conf('SYSLIBS'))"`
-	fi
+dnl	if test -z "$PYTHON_EXTRA_LDFLAGS"; then
+dnl	   PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \
+dnl                conf = distutils.sysconfig.get_config_var; \
+dnl                print (conf('LIBS') + ' ' + conf('SYSLIBS'))"`
+dnl	fi
 	AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS])
 	AC_SUBST(PYTHON_EXTRA_LDFLAGS)
 
--- a/m4/cython.m4	Fri Nov 17 01:23:06 2017 +0000
+++ b/m4/cython.m4	Fri Nov 17 10:08:02 2017 +0000
@@ -12,7 +12,7 @@
 AC_MSG_CHECKING(for Cython$_msg)
 AC_CACHE_VAL(py_cv_cython, [
 
-prog="import Cython.Compiler.Version; print Cython.Compiler.Version.version"
+prog="from __future__ import print_function; import Cython.Compiler.Version; print(Cython.Compiler.Version.version)"
 CYTHON_VERSION=`$PYTHON -c "$prog" 2>&AC_FD_CC`


More information about the Rivet-svn mailing list