[Rpm-maint] [PATCH 01/15] Generalize python configuration code to support both Python 2.* and Python 3.*

David Malcolm dmalcolm at redhat.com
Thu Oct 15 19:14:55 UTC 2009


Python 3 changes "print" from being a statement to a function, and thus it requires
parentheses for Python 3, and lack of parentheses for Python 2.

Rewrite to use sys.stdout.write, thus avoiding the issue
---
 configure.ac |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index f9d6cab..2a2b7bf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -673,7 +673,7 @@ AS_IF([test "$enable_python" = yes],[
 # rpm-python is based on python-2.5, 
 # with legacy hacks to allow building against python >= 2.3
   AM_PATH_PYTHON([2.3],[
-    WITH_PYTHON_INCLUDE=`${PYTHON} -c 'from distutils.sysconfig import *; print get_python_inc()'`
+    WITH_PYTHON_INCLUDE=`${PYTHON} -c 'from distutils.sysconfig import *; import sys; sys.stdout.write("%s\n" % get_python_inc())'`
     WITH_PYTHON_SUBPACKAGE=1
     save_CPPFLAGS="$CPPFLAGS"
     CPPFLAGS="$CPPFLAGS -I$WITH_PYTHON_INCLUDE"
-- 
1.6.2.5



More information about the Rpm-maint mailing list