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, 07 Jun 2022 06:55:00
Message-Id: 1654584831.63fff67a31e4f9e9982e9e6496a873caca81e591.mgorny@gentoo
1 commit: 63fff67a31e4f9e9982e9e6496a873caca81e591
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jun 1 07:54:21 2022 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Tue Jun 7 06:53:51 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=63fff67a
7
8 python-utils-r1.eclass: Support python_domodule outside src_install
9
10 Make it possible to use python_domodule() outside src_install(),
11 in order to install files into the ${BUILD_DIR}/install tree used
12 by distutils-r1.
13
14 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
15
16 eclass/python-utils-r1.eclass | 29 ++++++++++++++++++++++-------
17 1 file changed, 22 insertions(+), 7 deletions(-)
18
19 diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
20 index b3c249dfa694..fd04cf374ce4 100644
21 --- a/eclass/python-utils-r1.eclass
22 +++ b/eclass/python-utils-r1.eclass
23 @@ -832,6 +832,10 @@ python_moduleinto() {
24 # and packages (directories). All listed files will be installed
25 # for all enabled implementations, and compiled afterwards.
26 #
27 +# The files are installed into ${D} when run in src_install() phase.
28 +# Otherwise, they are installed into ${BUILD_DIR}/install location
29 +# that is suitable for picking up by distutils-r1 in PEP517 mode.
30 +#
31 # Example:
32 # @CODE
33 # src_install() {
34 @@ -854,13 +858,24 @@ python_domodule() {
35 d=${sitedir#${EPREFIX}}/${_PYTHON_MODULEROOT//.//}
36 fi
37
38 - (
39 - insopts -m 0644
40 - insinto "${d}"
41 - doins -r "${@}" || return ${?}
42 - )
43 -
44 - python_optimize "${ED%/}/${d}"
45 + if [[ ${EBUILD_PHASE} == install ]]; then
46 + (
47 + insopts -m 0644
48 + insinto "${d}"
49 + doins -r "${@}" || return ${?}
50 + )
51 + python_optimize "${ED%/}/${d}"
52 + elif [[ -n ${BUILD_DIR} ]]; then
53 + local dest=${BUILD_DIR}/install${EPREFIX}/${d}
54 + mkdir -p "${dest}" || die
55 + cp -pR "${@}" "${dest}/" || die
56 + (
57 + cd "${dest}" &&
58 + chmod -R a+rX "${@##*/}"
59 + ) || die
60 + else
61 + die "${FUNCNAME} can only be used in src_install or with BUILD_DIR set"
62 + fi
63 }
64
65 # @FUNCTION: python_doheader