From 73ce9c2f2272b9801255c595772cb6e29c08c645 Mon Sep 17 00:00:00 2001 From: Leo Mao Date: Tue, 2 Oct 2018 14:37:56 +0800 Subject: [PATCH] Use get_python_inc and print function in install scripts Use the function form of `print` to support both python 2 and 3. Use get_python_inc from sysconfig, this function is simpler. --- tools/extras/install_mmseg.sh | 2 +- tools/extras/install_phonetisaurus.sh | 2 +- tools/extras/install_sequitur.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/extras/install_mmseg.sh b/tools/extras/install_mmseg.sh index 586740b5cbc..3c50ddc7dad 100755 --- a/tools/extras/install_mmseg.sh +++ b/tools/extras/install_mmseg.sh @@ -18,7 +18,7 @@ if ! $(python -c "import distutils.sysconfig" &> /dev/null); then echo "Proceeding with installation." >&2 else # get include path for this python version - INCLUDE_PY=$(python -c "from distutils import sysconfig as s; print s.get_config_vars()['INCLUDEPY']") + INCLUDE_PY=$(python -c "from distutils import sysconfig as s; print(s.get_python_inc())") if [ ! -f "${INCLUDE_PY}/Python.h" ]; then echo "$0 : ERROR: python-devel/python-dev not installed" >&2 if which yum >&/dev/null; then diff --git a/tools/extras/install_phonetisaurus.sh b/tools/extras/install_phonetisaurus.sh index 617aa341b32..e7594233d52 100755 --- a/tools/extras/install_phonetisaurus.sh +++ b/tools/extras/install_phonetisaurus.sh @@ -21,7 +21,7 @@ if ! $(python -c "import distutils.sysconfig" &> /dev/null); then echo "Proceeding with installation." >&2 else # get include path for this python version - INCLUDE_PY=$(python -c "from distutils import sysconfig as s; print s.get_config_vars()['INCLUDEPY']") + INCLUDE_PY=$(python -c "from distutils import sysconfig as s; print(s.get_python_inc())") if [ ! -f "${INCLUDE_PY}/Python.h" ]; then echo "$0 : ERROR: python-devel/python-dev not installed" >&2 if which yum >&/dev/null; then diff --git a/tools/extras/install_sequitur.sh b/tools/extras/install_sequitur.sh index 6ee4d9f4336..4250006651b 100755 --- a/tools/extras/install_sequitur.sh +++ b/tools/extras/install_sequitur.sh @@ -18,7 +18,7 @@ if ! $(python -c "import distutils.sysconfig" &> /dev/null); then echo "Proceeding with installation." >&2 else # get include path for this python version - INCLUDE_PY=$(python -c "from distutils import sysconfig as s; print s.get_config_vars()['INCLUDEPY']") + INCLUDE_PY=$(python -c "from distutils import sysconfig as s; print(s.get_python_inc())") if [ ! -f "${INCLUDE_PY}/Python.h" ]; then echo "$0 : ERROR: python-devel/python-dev not installed" >&2 if which yum >&/dev/null; then