diff options
author | Karl Berry <karl@freefriends.org> | 2021-05-18 15:12:56 -0700 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-05-18 15:12:56 -0700 |
commit | b83830c8dc4a75b6a82f0e666f60dc966637162c (patch) | |
tree | 37b7ada743eeca3cabc4ba6b7fa26a2fca9baa08 /t | |
parent | ed8daa069a6c8ed34f7856c42402ec46f305e670 (diff) | |
download | automake-b83830c8dc4a75b6a82f0e666f60dc966637162c.tar.gz |
python: new python-prefix test.
* t/python-prefix.sh: new test.
* t/list-of-tests.mk (handwritten_tests): add it.
* NEWS: describe new Python prefix behavior.
Diffstat (limited to 't')
-rw-r--r-- | t/list-of-tests.mk | 1 | ||||
-rwxr-xr-x | t/python-prefix.sh | 91 |
2 files changed, 92 insertions, 0 deletions
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk index a3cb0004f..51456ef51 100644 --- a/t/list-of-tests.mk +++ b/t/list-of-tests.mk @@ -926,6 +926,7 @@ t/python-am-path-iftrue.sh \ t/python-missing.sh \ t/python-too-old.sh \ t/python-dist.sh \ +t/python-prefix.sh \ t/python-vars.sh \ t/python-virtualenv.sh \ t/python-pr10995.sh \ diff --git a/t/python-prefix.sh b/t/python-prefix.sh new file mode 100755 index 000000000..f6a2d9bf3 --- /dev/null +++ b/t/python-prefix.sh @@ -0,0 +1,91 @@ +#! /bin/sh +# Copyright (C) 2021 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + +# Test configure options --with-python_prefix and --with-python_exec_prefix. +# We can't test with no prefixes specified, since the default is to +# install in Python's sys.prefix and sys.exec_prefix directories. + +required=python +. test-init.sh + +cat >>configure.ac <<EOF +AM_PATH_PYTHON +AC_OUTPUT +EOF + +cat >Makefile.am <<'END' +# to be installed in pythondir: +python_PYTHON = one.py + +# to be installed in pythonpkgdir: +pkgpython_PYTHON = pkgtwo.py + +one.py: + echo 'def one(): return 1' >$@ || rm -f $@ +pkgtwo.py: + echo 'def pkgtwo(): return 1' >$@ || rm -f $@ + +# It's too much trouble to build and install something that actually +# needs to be under exec_prefix. Instead, we'll just check the value of +# the variable. +echo-python-exec-prefix: + @echo $(PYTHON_EXEC_PREFIX) +END + +py_version=$(python -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 + +# First test: if --with-python_prefix is given, by default it should +# be used for python_exec_prefix too. +# +$ACLOCAL +$AUTOCONF +$AUTOMAKE --add-missing + +mkdir build +cd build +../configure --with-python_prefix="$(pwd)/inst" +$MAKE install +# +py_installed "$py_inst_site"/one.py +py_installed "$py_inst_site"/one.pyc +# +py_installed "$py_inst_site"/python-prefix/pkgtwo.py +py_installed "$py_inst_site"/python-prefix/pkgtwo.pyc +# +test "`$MAKE echo-python-exec-prefix`" = "$(pwd)/inst" + +# Second test: specify different --with-python_prefix +# and --with-python_exec_prefix values. +# +cd .. +rm -rf build auto4mte.cache +mkdir build +cd build +../configure --with-python_prefix="$(pwd)/inst" \ + --with-python_exec_prefix="$(pwd)/instexec" +$MAKE install +# +py_installed "$py_inst_site"/one.py +py_installed "$py_inst_site"/one.pyc +# +py_installed "$py_inst_site"/python-prefix/pkgtwo.py +py_installed "$py_inst_site"/python-prefix/pkgtwo.pyc +# +test "`$MAKE echo-python-exec-prefix`" = "$(pwd)/instexec" + +: |