[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[automake-commit] 02/02: python: new python-prefix test.
From: |
Karl Berry |
Subject: |
[automake-commit] 02/02: python: new python-prefix test. |
Date: |
Tue, 18 May 2021 18:13:09 -0400 |
karl pushed a commit to branch master
in repository automake.
View the commit online:
https://git.savannah.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=b83830c8dc4a75b6a82f0e666f60dc966637162c
commit b83830c8dc4a75b6a82f0e666f60dc966637162c
Author: Karl Berry <karl@freefriends.org>
AuthorDate: Tue May 18 15:12:56 2021 -0700
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.
---
NEWS | 5 +++
t/list-of-tests.mk | 1 +
t/python-prefix.sh | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 97 insertions(+)
diff --git a/NEWS b/NEWS
index e692d97..aee9f4e 100644
--- a/NEWS
+++ b/NEWS
@@ -68,6 +68,11 @@ New in ?.?.?:
- CTAGS, ETAGS, SCOPE variables can be set via configure.
+ - PYTHON_PREFIX and PYTHON_EXEC_PREFIX variables now set from Python's
+ sys.prefix and sys.exec_prefix; new configure options
+ --with-python_prefix and --with-python_exec_prefix supported,
+ to specify explicitly.
+
* Bugs fixed
- automake output reproducible.
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index a3cb000..51456ef 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 0000000..f6a2d9b
--- /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"
+
+: