[libvirt] [libvirt-glib][PATCH 1/2] configure: Detect python in compatible fashion

Michal Privoznik mprivozn at redhat.com
Mon Aug 1 09:47:42 UTC 2016


In the configure script we try to detect what version of python
is there currently installed on the system. We use `python -c
"some cmd"` to find out. However, the syntax we use for "some
cmd" is plainly just for 2.x and throws an error for 3.x.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 configure.ac | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 8edde74..91929e8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -200,7 +200,7 @@ if test "$with_python" != "no" ; then
 	    if test -x "$PYTHON"
 	    then
 	        echo Found python in environment PYTHON=$PYTHON
-		with_python=`$PYTHON -c "import sys; print sys.exec_prefix"`
+		with_python=`$PYTHON -c "import sys; print(sys.exec_prefix)"`
 	    else
 		AC_PATH_PROG([PYTHON], [python python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5])
 	    fi
@@ -208,7 +208,7 @@ if test "$with_python" != "no" ; then
     fi
     if test "$PYTHON" != ""
     then
-        PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[[0:3]]"`
+        PYTHON_VERSION=`$PYTHON -c "import sys; print(sys.version[[0:3]])"`
 	echo Found Python version $PYTHON_VERSION
     fi
     if test "$PYTHON_VERSION" != ""
@@ -234,7 +234,7 @@ if test "$with_python" != "no" ; then
 	    fi
 	    if test ! -d "$PYTHON_SITE_PACKAGES"
 	    then
-		    PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"`
+		    PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_lib())"`
 	    fi
 	fi
     fi
-- 
2.8.4




More information about the libvir-list mailing list