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