summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2022-06-01 09:54:21 +0200
committerMichał Górny <mgorny@gentoo.org>2022-06-07 08:53:51 +0200
commit63fff67a31e4f9e9982e9e6496a873caca81e591 (patch)
tree99f65b25812d423f005eb4096315f925c9957f98 /eclass
parentpython-utils-r1.eclass: Fix typo in python_moduleinto doc (diff)
downloadgentoo-63fff67a31e4f9e9982e9e6496a873caca81e591.tar.gz
gentoo-63fff67a31e4f9e9982e9e6496a873caca81e591.tar.bz2
gentoo-63fff67a31e4f9e9982e9e6496a873caca81e591.zip
python-utils-r1.eclass: Support python_domodule outside src_install
Make it possible to use python_domodule() outside src_install(), in order to install files into the ${BUILD_DIR}/install tree used by distutils-r1. Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/python-utils-r1.eclass29
1 files changed, 22 insertions, 7 deletions
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index b3c249dfa694..fd04cf374ce4 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -832,6 +832,10 @@ python_moduleinto() {
# and packages (directories). All listed files will be installed
# for all enabled implementations, and compiled afterwards.
#
+# The files are installed into ${D} when run in src_install() phase.
+# Otherwise, they are installed into ${BUILD_DIR}/install location
+# that is suitable for picking up by distutils-r1 in PEP517 mode.
+#
# Example:
# @CODE
# src_install() {
@@ -854,13 +858,24 @@ python_domodule() {
d=${sitedir#${EPREFIX}}/${_PYTHON_MODULEROOT//.//}
fi
- (
- insopts -m 0644
- insinto "${d}"
- doins -r "${@}" || return ${?}
- )
-
- python_optimize "${ED%/}/${d}"
+ if [[ ${EBUILD_PHASE} == install ]]; then
+ (
+ insopts -m 0644
+ insinto "${d}"
+ doins -r "${@}" || return ${?}
+ )
+ python_optimize "${ED%/}/${d}"
+ elif [[ -n ${BUILD_DIR} ]]; then
+ local dest=${BUILD_DIR}/install${EPREFIX}/${d}
+ mkdir -p "${dest}" || die
+ cp -pR "${@}" "${dest}/" || die
+ (
+ cd "${dest}" &&
+ chmod -R a+rX "${@##*/}"
+ ) || die
+ else
+ die "${FUNCNAME} can only be used in src_install or with BUILD_DIR set"
+ fi
}
# @FUNCTION: python_doheader