summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2020-11-29 00:30:37 +0100
committerMichał Górny <mgorny@gentoo.org>2020-12-01 11:31:50 +0100
commit285f1c5cf2789203db207bc4262630053a996c78 (patch)
treeb297adceed4d784c5c2ab3c3ac9375a09177d54a /eclass
parentdev-python/sphinx_rtd_theme: ~x64-macos added (diff)
downloadgentoo-285f1c5cf2789203db207bc4262630053a996c78.tar.gz
gentoo-285f1c5cf2789203db207bc4262630053a996c78.tar.bz2
gentoo-285f1c5cf2789203db207bc4262630053a996c78.zip
distutils-r1.eclass: Introduce install_for_testing --via-root
Introduce a new --via-root mode for distutils_install_for_testing function. The legacy --via-home seems to no longer work for a lot of packages but before we can confirm that --via-root is good enough for every single one of them, let's have two variants to choose from. The general recommendation is to try --via-root, and explicitly specify --via-home if the former does not work. Once all packages have explicit --via-*, we will decide how to proceed. Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/distutils-r1.eclass51
1 files changed, 42 insertions, 9 deletions
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 25cb67b78a31..a0eb41e689a9 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -492,7 +492,7 @@ esetup.py() {
}
# @FUNCTION: distutils_install_for_testing
-# @USAGE: [<args>...]
+# @USAGE: [--via-root|--via-home] [<args>...]
# @DESCRIPTION:
# Install the package into a temporary location for running tests.
# Update PYTHONPATH appropriately and set TEST_DIR to the test
@@ -503,11 +503,19 @@ esetup.py() {
# namespaces (and therefore proper install needs to be done to enforce
# PYTHONPATH) or tests rely on the results of install command.
# For most of the packages, tests built in BUILD_DIR are good enough.
+#
+# The function supports two install modes. The current default is
+# the legacy --via-home mode. However, it has problems with newer
+# versions of setuptools (50.3.0+). The --via-root mode generally
+# works for these packages, and it will probably become the default
+# in the future, once we test all affected packages. Please note
+# that proper testing sometimes requires unmerging the package first.
distutils_install_for_testing() {
debug-print-function ${FUNCNAME} "${@}"
# A few notes:
- # 1) because of namespaces, we can't use 'install --root',
+ # 1) because of namespaces, we can't use 'install --root'
+ # (NB: this is probably no longer true with py3),
# 2) 'install --home' is terribly broken on pypy, so we need
# to override --install-lib and --install-scripts,
# 3) non-root 'install' complains about PYTHONPATH and missing dirs,
@@ -522,14 +530,39 @@ distutils_install_for_testing() {
PATH=${bindir}:${PATH}
PYTHONPATH=${libdir}:${PYTHONPATH}
- local add_args=(
- install
- --home="${TEST_DIR}"
- --install-lib="${libdir}"
- --install-scripts="${bindir}"
- )
+ local install_method=home
+ case ${1} in
+ --via-home)
+ install_method=home
+ shift
+ ;;
+ --via-root)
+ install_method=root
+ shift
+ ;;
+ esac
+
+ local -a add_args
+ case ${install_method} in
+ home)
+ add_args=(
+ install
+ --home="${TEST_DIR}"
+ --install-lib="${libdir}"
+ --install-scripts="${bindir}"
+ )
+ mkdir -p "${libdir}" || die
+ ;;
+ root)
+ add_args=(
+ install
+ --root="${TEST_DIR}"
+ --install-lib=lib
+ --install-scripts=scripts
+ )
+ ;;
+ esac
- mkdir -p "${libdir}" || die
esetup.py "${add_args[@]}" "${@}"
}