From 971ac0baae6b4ce099afb8aab193a7a6b05110d1 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Thu, 29 Dec 2022 13:16:01 -0800 Subject: [PATCH] Autotools: remove legacy `python` discovery When removing Python 2 support, the discovery paths that checked for the Python interpreter as `python` were retained to support older distros in the Red Hat ecosystem where Python 3 goes by the name `python`. All currently supported distros use the name `python3`, so this code is no longer needed. Gitlab: related to #2332 --- CHANGELOG.md | 6 +++++ configure.ac | 53 ++------------------------------------ tclpkg/Makefile.am | 14 ---------- tclpkg/gv/Makefile.am | 26 ------------------- tclpkg/gv/demo/Makefile.am | 4 --- 5 files changed, 8 insertions(+), 95 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fa7dab957..7e288817b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased (7.0.6)] +### Changed + +- The Autotools build system no longer looks for `python` binaries. The Python + interpreter is unconditionally assumed to be `python3`. The configure option + `--enable-python` is now an alias for `--enable-python3`. + ### Fixed - The modgraph.php example no longer includes gv.php, which is no longer diff --git a/configure.ac b/configure.ac index 91919b068..ef8a8113f 100644 --- a/configure.ac +++ b/configure.ac @@ -1099,58 +1099,10 @@ AM_CONDITIONAL(WITH_PHP, [test "x$use_php" = "xYes"]) dnl ----------------------------------- dnl INCLUDES and LIBS for PYTHON +# alias for `--enable-python3` AC_ARG_ENABLE(python, [AS_HELP_STRING([--enable-python=yes],[python language bindings])], - [], [enable_python=yes]) - -if test "x$enable_python" != "xyes"; then - use_python="No (disabled)" -else - if test "x$use_swig" != "xYes"; then - use_python="No (swig not available)" - else - if test `$SWIG -help 2>&1 | $EGREP -c '\-python *- Generate'` = 0; then - use_python="No (swig does not support -python option)" - else - AC_CHECK_PROG(PYTHON,python,python) - if test "x$PYTHON" = "x"; then - use_python="No (python not available)" - else - PYTHON_VERSION=`$PYTHON -c "import sys; print('%d.%d' % sys.version_info[[0:2]])"` - if test "x$PYTHON_VERSION" = "x"; then - PYTHON= - else - AX_COMPARE_VERSION([$PYTHON_VERSION], [lt], [3], [PYTHON=]) - fi - fi - if test "x$PYTHON" = "x"; then - use_python="No (python is too old)" - else - PYTHON_PREFIX=`$PYTHON -c "import sys; print(sys.prefix)"` - PYTHON_INCLUDES=-I$PYTHON_PREFIX/include/python$PYTHON_VERSION - PYTHON_LIBS="-undefined dynamic_lookup" - PYTHON_INSTALL_DIR="`$PYTHON -c 'from distutils import sysconfig; print(sysconfig.get_python_lib(1,0))'`" - save_CPPFLAGS=$CPPFLAGS - CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES" - AC_CHECK_HEADER(Python.h,,[ - use_python="No (missing header)" - PYTHON= - ]) - CPPFLAGS=$save_CPPFLAGS - if test "x$PYTHON" != "x"; then - use_python="Yes" - AC_SUBST([PYTHON_INSTALL_DIR]) - AC_SUBST([PYTHON_INCLUDES]) - AC_SUBST([PYTHON_LIBS]) - fi - fi - fi - fi -fi -AM_CONDITIONAL(WITH_PYTHON, [test "x$use_python" = "xYes"]) - -dnl ----------------------------------- -dnl INCLUDES and LIBS for PYTHON3 + [], [enable_python3=yes]) AC_ARG_ENABLE(python3, [AS_HELP_STRING([--enable-python3=yes],[python3 language bindings])], @@ -2648,7 +2600,6 @@ echo " gv_lua: $use_lua" echo " gv_ocaml: $use_ocaml" echo " gv_perl: $use_perl" echo " gv_php: $use_php" -echo " gv_python: $use_python" echo " gv_python3: $use_python3" echo " gv_R: $use_r" echo " gv_ruby: $use_ruby" diff --git a/tclpkg/Makefile.am b/tclpkg/Makefile.am index 707812dfa..dd851a5ff 100644 --- a/tclpkg/Makefile.am +++ b/tclpkg/Makefile.am @@ -9,7 +9,6 @@ pkgluadir = $(pkglibdir)/lua pkgocamldir = $(pkglibdir)/ocaml pkgperldir = $(pkglibdir)/perl pkgphpdir = $(pkglibdir)/php -pkgpythondir = $(pkglibdir)/python pkgpython3dir = $(pkglibdir)/python3 pkgRdir = $(pkglibdir)/R pkgrubydir = $(pkglibdir)/ruby @@ -74,17 +73,6 @@ if WITH_SWIG_PHP_DATA fi endif endif -if WITH_PYTHON - -mkdir -p $(DESTDIR)$(PYTHON_INSTALL_DIR); - if test -w $(DESTDIR)$(PYTHON_INSTALL_DIR); then \ - (cd $(DESTDIR)$(PYTHON_INSTALL_DIR); \ - cp -f $(DESTDIR)$(pkgpythondir)/libgv_python.so _gv.so; \ - cp -f $(DESTDIR)$(pkgpythondir)/gv.py gv.py;) \ - else \ - echo "Warning: $(PYTHON_INSTALL_DIR) is not writable."; \ - echo "Skipping system installation of python binding."; \ - fi -endif if WITH_PYTHON3 -mkdir -p $(DESTDIR)$(PYTHON3_INSTALL_DIR); if test -w $(DESTDIR)$(PYTHON3_INSTALL_DIR); then \ @@ -133,8 +121,6 @@ uninstall-hook: -rm -rf $(DESTDIR)$(PERL_INSTALL_DIR)/gv.so $(DESTDIR)$(PERL_INSTALL_DIR)/gv.pm; -rm -rf $(DESTDIR)$(pkgphpdir); -rm -rf $(DESTDIR)$(PHP_INSTALL_DIR)/gv.so $(DESTDIR)$(PHP_INSTALL_DATADIR)/gv.php; - -rm -rf $(DESTDIR)$(pkgpythondir); - -rm -rf $(DESTDIR)$(PYTHON_INSTALL_DIR)/_gv.so $(DESTDIR)$(PYTHON_INSTALL_DIR)/gv.py; -rm -rf $(DESTDIR)$(pkgpython3dir); -rm -rf $(DESTDIR)$(PYTHON3_INSTALL_DIR)/_gv.so $(DESTDIR)$(PYTHON3_INSTALL_DIR)/gv.py; -rm -rf $(DESTDIR)$(pkgRdir); diff --git a/tclpkg/gv/Makefile.am b/tclpkg/gv/Makefile.am index e94649c83..17207b860 100644 --- a/tclpkg/gv/Makefile.am +++ b/tclpkg/gv/Makefile.am @@ -201,17 +201,6 @@ php_gv.h: gv_php.cpp gv_php.cpp: gv.i $(SWIG) -c++ $(SWIG_PHP_OPT) -o $@ $(srcdir)/gv.i -pkgpythondir = $(pkglibdir)/python -PYTHON_data = gv.py -nodist_libgv_python_la_SOURCES = gv_python.cpp $(PYTHON_data) -libgv_python_la_SOURCES = $(BASESOURCES) gv_dummy_init.c -libgv_python_la_LIBADD = $(BASELIBS) $(PYTHON_LIBS) -libgv_python_la_LDFLAGS = -module -avoid-version -libgv_python_la_CPPFLAGS = $(BASECPPFLAGS) $(PYTHON_INCLUDES) -$(PYTHON_data): gv_python.cpp -gv_python.cpp: gv.i - $(SWIG) -c++ -python -o $@ $(srcdir)/gv.i - pkgpython3dir = $(pkglibdir)/python3 PYTHON3_data = gv.py nodist_libgv_python3_la_SOURCES = gv_python3.cpp $(PYTHON3_data) @@ -356,11 +345,6 @@ endif pkgphp_LTLIBRARIES = libgv_php.la DEVTSTS += test_php endif -if WITH_PYTHON -pkgpython_DATA = $(PYTHON_data) -pkgpython_LTLIBRARIES = libgv_python.la -DEVTSTS += test_python -endif if WITH_PYTHON3 pkgpython3_DATA = $(PYTHON3_data) pkgpython3_LTLIBRARIES = libgv_python3.la @@ -482,9 +466,6 @@ endif if WITH_PHP (cd $(DESTDIR)$(pkgphpdir); rm -f gv.so; $(LN_S) libgv_php.so gv.so;) endif -if WITH_PYTHON - (cd $(DESTDIR)$(pkgpythondir); rm -f _gv.so; $(LN_S) libgv_python.so _gv.so;) -endif if WITH_PYTHON3 (cd $(DESTDIR)$(pkgpython3dir); rm -f _gv.so; $(LN_S) libgv_python3.so _gv.so;) endif @@ -568,13 +549,6 @@ test_php: libgv_php.la ln -fs ../$(srcdir)/*.gv ../$(srcdir)/*.php .; \ $(PHP) ./test.php) -.PHONY: test_python -test_python: libgv_python.la - -(mkdir -p test_python; cd test_python; \ - ln -fs ../.libs/libgv_python.so _gv.so; \ - ln -fs ../$(srcdir)/*.gv ../$(srcdir)/*.py .; \ - PYTHONPATH=. $(PYTHON) test.py) - .PHONY: test_python3 test_python3: libgv_python3.la -(mkdir -p test_python3; cd test_python3; \ diff --git a/tclpkg/gv/demo/Makefile.am b/tclpkg/gv/demo/Makefile.am index a6ab30805..6df2d0258 100644 --- a/tclpkg/gv/demo/Makefile.am +++ b/tclpkg/gv/demo/Makefile.am @@ -8,7 +8,6 @@ demoluadir = $(demodir) demoocamldir = $(demodir) demoperldir = $(demodir) demophpdir = $(demodir) -demopythondir = $(demodir) demopython3dir = $(demodir) demoRdir = $(demodir) demorubydir = $(demodir) @@ -39,9 +38,6 @@ endif if WITH_PHP demophp_SCRIPTS = modgraph.php endif -if WITH_PYTHON -demopython_SCRIPTS = modgraph.py -endif if WITH_PYTHON3 demopython3_SCRIPTS = modgraph.py endif -- 2.40.0