]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
python: generalize tests.
authorBogdan <bogdro_rep@gmx.us>
Fri, 7 Jul 2023 01:27:36 +0000 (18:27 -0700)
committerKarl Berry <karl@freefriends.org>
Fri, 7 Jul 2023 01:27:36 +0000 (18:27 -0700)
This change finishes fixing https://bugs.gnu.org/30556.

* t/python-prefix.sh: use $PYTHON if set, not hardwiring "python".
* t/python-virtualenv.sh (get-pyexecdir): new make target;
use it instead of hardwiring $py_site.

t/python-prefix.sh
t/python-virtualenv.sh

index df15e430095eb2cd903257e45fb64276b8ce3666..766f47258b8969f3990bac4c0c261b5a281c3e7f 100644 (file)
@@ -43,7 +43,12 @@ echo-python-exec-prefix:
        @echo $(PYTHON_EXEC_PREFIX)
 END
 
-py_version=$(python -c 'import sys; print("%u.%u" % sys.version_info[:2])')
+if test -z "$PYTHON"; then
+  py_exec=python
+else
+  py_exec=$PYTHON
+fi
+py_version=$("$py_exec" -c 'import sys; print("%u.%u" % sys.version_info[:2])')
 py_inst_site=inst/lib/python$py_version/site-packages
 py_instexec_site=instexec/lib/python$py_version/site-packages
 
index ae5d96ad6f021f1f62c59178705096afb6f8d86c..b06964b90f8e594c72364600fdb9568aeab497d3 100644 (file)
@@ -100,6 +100,8 @@ test-run:
        python -c 'from am_foo import foo_func; assert (foo_func () == 12345)'
        python -c 'from am_virtenv import old_am; assert (old_am () == "AutoMake")'
 all-local: debug
+get-pyexecdir:
+       @echo $(pyexecdir)
 END
 
 cat > am_foo.py << 'END'
@@ -127,8 +129,8 @@ check_install ()
   py_installed "$py_site"/am_foo.pyc
   py_installed "$py_site"/am_virtenv/__init__.py
   py_installed "$py_site"/am_virtenv/__init__.pyc
-  test -f      "$py_site"/libquux.a
-  test -f      "$py_site"/am_virtenv/libzardoz.a
+  test -f      "$($MAKE get-pyexecdir ${1+"$@"})"/libquux.a
+  test -f      "$($MAKE get-pyexecdir ${1+"$@"})"/am_virtenv/libzardoz.a
 }
 
 check_uninstall ()
@@ -139,8 +141,8 @@ check_uninstall ()
   py_installed --not "$py_site"/am_foo.pyc
   test ! -e          "$py_site"/am_virtenv/__init__.py
   py_installed --not "$py_site"/am_virtenv/__init__.pyc
-  test ! -e          "$py_site"/libquux.a
-  test ! -e          "$py_site"/am_virtenv/libzardoz.a
+  test ! -e          "$($MAKE get-pyexecdir ${1+"$@"})"/libquux.a
+  test ! -e          "$($MAKE get-pyexecdir ${1+"$@"})"/am_virtenv/libzardoz.a
 }
 
 $ACLOCAL