diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2009-10-19 10:30:48 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2009-10-19 10:30:48 +0300 |
commit | 63175d4d31469816c575ddb4de9698fb5c053536 (patch) | |
tree | 45fdb611b577c4d3e47a5578cc309dc569ba4ad4 | |
parent | 9707b5478bbad7251810247b2383f91b5bbabc16 (diff) | |
download | librpm-tizen-63175d4d31469816c575ddb4de9698fb5c053536.tar.gz librpm-tizen-63175d4d31469816c575ddb4de9698fb5c053536.tar.bz2 librpm-tizen-63175d4d31469816c575ddb4de9698fb5c053536.zip |
Avoid using python's print for Python 3.x compatibility
- print chanced from statement to a function in python 3, for our
purposes sys.stdout.write() is sufficient and avoids dealing with
the incompatibilities between Python 2.x and 3.x
- suggested by David Malcolm / Ville Skyttä
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | macros.in | 6 | ||||
-rw-r--r-- | scripts/macros.python.in | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac index f9d6cabd5..483316904 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(get_python_inc())'` WITH_PYTHON_SUBPACKAGE=1 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I$WITH_PYTHON_INCLUDE" @@ -1150,9 +1150,9 @@ done \ #------------------------------------------------------------------------------ # Useful python macros for determining python version and paths # -%python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()") -%python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)") -%python_version %(%{__python} -c "import sys; print sys.version[:3]") +%python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; import sys; sys.stdout.write(get_python_lib())") +%python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; import sys; sys.stdout.write(get_python_lib(1))") +%python_version %(%{__python} -c "import sys; sys.stdout.write(sys.version[:3])") #------------------------------------------------------------------------------ # arch macro for all Intel i?86 compatibile processors diff --git a/scripts/macros.python.in b/scripts/macros.python.in index c7832a67a..ea1f200fc 100644 --- a/scripts/macros.python.in +++ b/scripts/macros.python.in @@ -3,10 +3,10 @@ # %include %{_rpmconfigdir}/macros.python # python main version -%define py_ver %(echo `python -c "import sys; print sys.version[:3]"`) +%define py_ver %(echo `python -c "import sys; sys.stdout.write(sys.version[:3])"`) # directories -%define py_prefix %(echo `python -c "import sys; print sys.prefix"`) +%define py_prefix %(echo `python -c "import sys; sys.stdout.write(sys.prefix)"`) %define py_libdir %{py_prefix}/lib/python%{py_ver} %define py_incdir /usr/include/python%{py_ver} %define py_sitedir %{py_libdir}/site-packages |