Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Tue, 01 Dec 2020 10:32:10
Message-Id: 1606818710.285f1c5cf2789203db207bc4262630053a996c78.mgorny@gentoo
1 commit: 285f1c5cf2789203db207bc4262630053a996c78
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sat Nov 28 23:30:37 2020 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Tue Dec 1 10:31:50 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=285f1c5c
7
8 distutils-r1.eclass: Introduce install_for_testing --via-root
9
10 Introduce a new --via-root mode for distutils_install_for_testing
11 function. The legacy --via-home seems to no longer work for a lot
12 of packages but before we can confirm that --via-root is good enough
13 for every single one of them, let's have two variants to choose from.
14
15 The general recommendation is to try --via-root, and explicitly specify
16 --via-home if the former does not work. Once all packages have explicit
17 --via-*, we will decide how to proceed.
18
19 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
20
21 eclass/distutils-r1.eclass | 51 ++++++++++++++++++++++++++++++++++++++--------
22 1 file changed, 42 insertions(+), 9 deletions(-)
23
24 diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
25 index 25cb67b78a3..a0eb41e689a 100644
26 --- a/eclass/distutils-r1.eclass
27 +++ b/eclass/distutils-r1.eclass
28 @@ -492,7 +492,7 @@ esetup.py() {
29 }
30
31 # @FUNCTION: distutils_install_for_testing
32 -# @USAGE: [<args>...]
33 +# @USAGE: [--via-root|--via-home] [<args>...]
34 # @DESCRIPTION:
35 # Install the package into a temporary location for running tests.
36 # Update PYTHONPATH appropriately and set TEST_DIR to the test
37 @@ -503,11 +503,19 @@ esetup.py() {
38 # namespaces (and therefore proper install needs to be done to enforce
39 # PYTHONPATH) or tests rely on the results of install command.
40 # For most of the packages, tests built in BUILD_DIR are good enough.
41 +#
42 +# The function supports two install modes. The current default is
43 +# the legacy --via-home mode. However, it has problems with newer
44 +# versions of setuptools (50.3.0+). The --via-root mode generally
45 +# works for these packages, and it will probably become the default
46 +# in the future, once we test all affected packages. Please note
47 +# that proper testing sometimes requires unmerging the package first.
48 distutils_install_for_testing() {
49 debug-print-function ${FUNCNAME} "${@}"
50
51 # A few notes:
52 - # 1) because of namespaces, we can't use 'install --root',
53 + # 1) because of namespaces, we can't use 'install --root'
54 + # (NB: this is probably no longer true with py3),
55 # 2) 'install --home' is terribly broken on pypy, so we need
56 # to override --install-lib and --install-scripts,
57 # 3) non-root 'install' complains about PYTHONPATH and missing dirs,
58 @@ -522,14 +530,39 @@ distutils_install_for_testing() {
59 PATH=${bindir}:${PATH}
60 PYTHONPATH=${libdir}:${PYTHONPATH}
61
62 - local add_args=(
63 - install
64 - --home="${TEST_DIR}"
65 - --install-lib="${libdir}"
66 - --install-scripts="${bindir}"
67 - )
68 + local install_method=home
69 + case ${1} in
70 + --via-home)
71 + install_method=home
72 + shift
73 + ;;
74 + --via-root)
75 + install_method=root
76 + shift
77 + ;;
78 + esac
79 +
80 + local -a add_args
81 + case ${install_method} in
82 + home)
83 + add_args=(
84 + install
85 + --home="${TEST_DIR}"
86 + --install-lib="${libdir}"
87 + --install-scripts="${bindir}"
88 + )
89 + mkdir -p "${libdir}" || die
90 + ;;
91 + root)
92 + add_args=(
93 + install
94 + --root="${TEST_DIR}"
95 + --install-lib=lib
96 + --install-scripts=scripts
97 + )
98 + ;;
99 + esac
100
101 - mkdir -p "${libdir}" || die
102 esetup.py "${add_args[@]}" "${@}"
103 }