public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: "Michał Górny" <mgorny@gentoo.org>
Subject: [gentoo-dev] [PATCH 10/18] python-utils-r1.eclass: Support python_domodule outside src_install
Date: Sat,  4 Jun 2022 11:03:26 +0200	[thread overview]
Message-ID: <20220604090334.4003-11-mgorny@gentoo.org> (raw)
In-Reply-To: <20220604090334.4003-1-mgorny@gentoo.org>

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>
---
 eclass/python-utils-r1.eclass | 29 ++++++++++++++++++++++-------
 1 file 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
-- 
2.35.1



  parent reply	other threads:[~2022-06-04  9:07 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-04  9:03 [gentoo-dev] [PATCH 00/18] distutils-r1.eclass D_U_PEP517=no mode & other patches Michał Górny
2022-06-04  9:03 ` [gentoo-dev] [PATCH 01/18] python-utils-r1.eclass: Strip stray *-pytest-*.pyc files in epytest Michał Górny
2022-06-04  9:03 ` [gentoo-dev] [PATCH 02/18] distutils-r1.eclass: Support internal post-python_* phase functions Michał Górny
2022-06-04  9:03 ` [gentoo-dev] [PATCH 03/18] distutils-r1.eclass: Call egg-info cleanup via post-test phase Michał Górny
2022-06-04  9:03 ` [gentoo-dev] [PATCH 04/18] distutils-r1.eclass: Move install QA checks to post-phase function Michał Górny
2022-06-04  9:03 ` [gentoo-dev] [PATCH 05/18] distutils-r1.eclass: Remove the obsolete pypy/share check Michał Górny
2022-06-04  9:03 ` [gentoo-dev] [PATCH 06/18] distutils-r1.eclass: Make *-nspkg.pth warning fatal for EAPI 9+ Michał Górny
2022-06-04  9:03 ` [gentoo-dev] [PATCH 07/18] distutils-r1.eclass: Move venv/merge-root logic to post-phases Michał Górny
2022-06-04  9:03 ` [gentoo-dev] [PATCH 08/18] distutils-r1.eclass: Introduce DISTUTILS_USE_PEP517=no mode Michał Górny
2022-06-04  9:03 ` [gentoo-dev] [PATCH 09/18] python-utils-r1.eclass: Fix typo in python_moduleinto doc Michał Górny
2022-06-04  9:03 ` Michał Górny [this message]
2022-06-04  9:03 ` [gentoo-dev] [PATCH 11/18] python-utils-r1.eclass: Add explicit checks for incorrect phase Michał Górny
2022-06-04  9:03 ` [gentoo-dev] [PATCH 12/18] dev-python/tomli: Use DISTUTILS_USE_PEP517=no Michał Górny
2022-06-04  9:03 ` [gentoo-dev] [PATCH 13/18] dev-python/installer: " Michał Górny
2022-06-04  9:03 ` [gentoo-dev] [PATCH 14/18] dev-python/gpep517: " Michał Górny
2022-06-04  9:03 ` [gentoo-dev] [PATCH 15/18] app-admin/gnome-abrt: " Michał Górny
2022-06-04  9:03 ` [gentoo-dev] [PATCH 16/18] python-any-r1.eclass: use python_has_version in examples Michał Górny
2022-06-04  9:03 ` [gentoo-dev] [PATCH 17/18] distutils-r1.eclass: small docs format fixes Michał Górny
2022-06-04  9:03 ` [gentoo-dev] [PATCH 18/18] distutils-r1.eclass: Add "_trial_temp" to forbidden package names Michał Górny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220604090334.4003-11-mgorny@gentoo.org \
    --to=mgorny@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox