Skip to content

Commit a611d7b

Browse files
authored
Merge pull request #4883 from eginhard/distutils
[tools] Replace uses of Python distutils for 3.12 compatibility
2 parents bf248aa + 700bf93 commit a611d7b

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

tools/extras/install_cffi.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ echo "**** Installing Cffi and dependencies"
3535

3636
echo "Checking for Python-Dev"
3737
# copied from https://stackoverflow.com/questions/4848566/check-for-existence-of-python-dev-files-from-bash-script
38-
if [ ! -e $(python -c 'from distutils.sysconfig import get_makefile_filename as m; print m()') ]; then
38+
if [ ! -e $(python -c 'from sysconfig import get_makefile_filename as m; print m()') ]; then
3939
echo "On Debian/Ubuntu like system install by 'sudo apt-get python-dev' package."
4040
echo "On Fedora by 'yum install python-devel'"
4141
echo "On Mac OS X by 'brew install python'"

tools/extras/install_mmseg.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ fi
1616

1717

1818
# Install python-devel package if not already available
19-
# first, makes sure distutils.sysconfig usable
20-
if ! $(python -c "import distutils.sysconfig" &> /dev/null); then
21-
echo "$0: WARNING: python library distutils.sysconfig not usable, this is necessary to figure out the path of Python.h." >&2
19+
# first, makes sure sysconfig is usable
20+
if ! $(python -c "import sysconfig" &> /dev/null); then
21+
echo "$0: WARNING: python library sysconfig not usable, this is necessary to figure out the path of Python.h." >&2
2222
echo "Proceeding with installation." >&2
2323
else
2424
# get include path for this python version
25-
INCLUDE_PY=$(python -c "from distutils import sysconfig as s; print(s.get_python_inc())")
25+
INCLUDE_PY=$(python -c "import sysconfig as s; print(s.get_path('include'))")
2626
if [ ! -f "${INCLUDE_PY}/Python.h" ]; then
2727
echo "$0 : ERROR: python-devel/python-dev not installed" >&2
2828
if which yum >&/dev/null; then

tools/extras/install_phonetisaurus.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@ fi
1515
echo "You must call this script from the tools/ directory" && exit 1;
1616

1717
# Install python-devel package if not already available
18-
# first, makes sure distutils.sysconfig usable
18+
# first, makes sure sysconfig is usable
1919
# We are not currently compiling the bindings by default, but it seems
2020
# worth it to keep this section as we do have them and they will
2121
# probably be used.
22-
if ! $(python -c "import distutils.sysconfig" &> /dev/null); then
23-
echo "$0: WARNING: python library distutils.sysconfig not usable, this is necessary to figure out the path of Python.h." >&2
22+
if ! $(python -c "import sysconfig" &> /dev/null); then
23+
echo "$0: WARNING: python library sysconfig not usable, this is necessary to figure out the path of Python.h." >&2
2424
echo "Proceeding with installation." >&2
2525
else
2626
# get include path for this python version
27-
INCLUDE_PY=$(python -c "from distutils import sysconfig as s; print(s.get_python_inc())")
27+
INCLUDE_PY=$(python -c "import sysconfig as s; print(s.get_path('include'))")
2828
if [ ! -f "${INCLUDE_PY}/Python.h" ]; then
2929
echo "$0 : ERROR: python-devel/python-dev not installed" >&2
3030
if which yum >&/dev/null; then

tools/extras/install_sequitur.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ fi
1515
echo "You must call this script from the tools/ directory" && exit 1;
1616

1717
# Install python-devel package if not already available
18-
# first, makes sure distutils.sysconfig usable
19-
if ! $(python -c "import distutils.sysconfig" &> /dev/null); then
20-
echo "$0: WARNING: python library distutils.sysconfig not usable, this is necessary to figure out the path of Python.h." >&2
18+
# first, makes sure sysconfig is usable
19+
if ! $(python -c "import sysconfig" &> /dev/null); then
20+
echo "$0: WARNING: python library sysconfig not usable, this is necessary to figure out the path of Python.h." >&2
2121
echo "Proceeding with installation." >&2
2222
else
2323
# get include path for this python version
24-
INCLUDE_PY=$(python -c "from distutils import sysconfig as s; print(s.get_python_inc())")
24+
INCLUDE_PY=$(python -c "import sysconfig as s; print(s.get_path('include'))")
2525
if [ ! -f "${INCLUDE_PY}/Python.h" ]; then
2626
echo "$0 : ERROR: python-devel/python-dev not installed" >&2
2727
if which yum >&/dev/null; then

0 commit comments

Comments
 (0)