Skip to content

Commit

Permalink
Merge pull request #4883 from eginhard/distutils
Browse files Browse the repository at this point in the history
[tools] Replace uses of Python distutils for 3.12 compatibility
  • Loading branch information
danpovey authored Nov 13, 2023
2 parents bf248aa + 700bf93 commit a611d7b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion tools/extras/install_cffi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ echo "**** Installing Cffi and dependencies"

echo "Checking for Python-Dev"
# copied from https://stackoverflow.com/questions/4848566/check-for-existence-of-python-dev-files-from-bash-script
if [ ! -e $(python -c 'from distutils.sysconfig import get_makefile_filename as m; print m()') ]; then
if [ ! -e $(python -c 'from sysconfig import get_makefile_filename as m; print m()') ]; then
echo "On Debian/Ubuntu like system install by 'sudo apt-get python-dev' package."
echo "On Fedora by 'yum install python-devel'"
echo "On Mac OS X by 'brew install python'"
Expand Down
8 changes: 4 additions & 4 deletions tools/extras/install_mmseg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ fi


# Install python-devel package if not already available
# first, makes sure distutils.sysconfig usable
if ! $(python -c "import distutils.sysconfig" &> /dev/null); then
echo "$0: WARNING: python library distutils.sysconfig not usable, this is necessary to figure out the path of Python.h." >&2
# first, makes sure sysconfig is usable
if ! $(python -c "import sysconfig" &> /dev/null); then
echo "$0: WARNING: python library sysconfig not usable, this is necessary to figure out the path of Python.h." >&2
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_python_inc())")
INCLUDE_PY=$(python -c "import sysconfig as s; print(s.get_path('include'))")
if [ ! -f "${INCLUDE_PY}/Python.h" ]; then
echo "$0 : ERROR: python-devel/python-dev not installed" >&2
if which yum >&/dev/null; then
Expand Down
8 changes: 4 additions & 4 deletions tools/extras/install_phonetisaurus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ fi
echo "You must call this script from the tools/ directory" && exit 1;

# Install python-devel package if not already available
# first, makes sure distutils.sysconfig usable
# first, makes sure sysconfig is usable
# We are not currently compiling the bindings by default, but it seems
# worth it to keep this section as we do have them and they will
# probably be used.
if ! $(python -c "import distutils.sysconfig" &> /dev/null); then
echo "$0: WARNING: python library distutils.sysconfig not usable, this is necessary to figure out the path of Python.h." >&2
if ! $(python -c "import sysconfig" &> /dev/null); then
echo "$0: WARNING: python library sysconfig not usable, this is necessary to figure out the path of Python.h." >&2
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_python_inc())")
INCLUDE_PY=$(python -c "import sysconfig as s; print(s.get_path('include'))")
if [ ! -f "${INCLUDE_PY}/Python.h" ]; then
echo "$0 : ERROR: python-devel/python-dev not installed" >&2
if which yum >&/dev/null; then
Expand Down
8 changes: 4 additions & 4 deletions tools/extras/install_sequitur.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ fi
echo "You must call this script from the tools/ directory" && exit 1;

# Install python-devel package if not already available
# first, makes sure distutils.sysconfig usable
if ! $(python -c "import distutils.sysconfig" &> /dev/null); then
echo "$0: WARNING: python library distutils.sysconfig not usable, this is necessary to figure out the path of Python.h." >&2
# first, makes sure sysconfig is usable
if ! $(python -c "import sysconfig" &> /dev/null); then
echo "$0: WARNING: python library sysconfig not usable, this is necessary to figure out the path of Python.h." >&2
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_python_inc())")
INCLUDE_PY=$(python -c "import sysconfig as s; print(s.get_path('include'))")
if [ ! -f "${INCLUDE_PY}/Python.h" ]; then
echo "$0 : ERROR: python-devel/python-dev not installed" >&2
if which yum >&/dev/null; then
Expand Down

0 comments on commit a611d7b

Please sign in to comment.