summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2022-06-07 17:33:59 +0200
committerMichał Górny <mgorny@gentoo.org>2022-06-08 09:53:48 +0200
commit448736a03302467f8a44f47467e486c26e87bb6c (patch)
tree35e582d2a5586f934eb29923a26ae6d886f55698 /eclass
parentdev-python/exceptiongroup: Bump to 1.0.0_rc8 (diff)
downloadgentoo-448736a03302467f8a44f47467e486c26e87bb6c.tar.gz
gentoo-448736a03302467f8a44f47467e486c26e87bb6c.tar.bz2
gentoo-448736a03302467f8a44f47467e486c26e87bb6c.zip
distutils-r1.eclass: Move venv creation to post-compile
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/distutils-r1.eclass65
1 files changed, 38 insertions, 27 deletions
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 7829e521ca7b..e5e11c75e39f 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -1370,33 +1370,7 @@ distutils-r1_python_compile() {
addpredict /usr/lib/portage/pym
addpredict /usr/local # bug 498232
- local root=${BUILD_DIR}/install
- distutils_pep517_install "${root}"
-
- # copy executables to python-exec directory
- # we do it early so that we can alter bindir recklessly
- local bindir=${root}${EPREFIX}/usr/bin
- local rscriptdir=${root}$(python_get_scriptdir)
- [[ -d ${rscriptdir} ]] &&
- die "${rscriptdir} should not exist!"
- if [[ -d ${bindir} ]]; then
- mkdir -p "${rscriptdir}" || die
- cp -a --reflink=auto "${bindir}"/. "${rscriptdir}"/ || die
- fi
-
- # enable venv magic inside the install tree
- mkdir -p "${bindir}" || die
- ln -s "${PYTHON}" "${bindir}/${EPYTHON}" || die
- ln -s "${EPYTHON}" "${bindir}/python3" || die
- ln -s "${EPYTHON}" "${bindir}/python" || die
- cat > "${bindir}"/pyvenv.cfg <<-EOF || die
- include-system-site-packages = true
- EOF
-
- # we need to change shebangs to point to the venv-python
- find "${bindir}" -type f -exec sed -i \
- -e "1s@^#!\(${EPREFIX}/usr/bin/\(python\|pypy\)\)@#!${root}\1@" \
- {} + || die
+ distutils_pep517_install "${BUILD_DIR}/install"
fi
}
@@ -1775,6 +1749,43 @@ distutils-r1_src_configure() {
return ${ret}
}
+# @FUNCTION: _distutils-r1_post_python_compile
+# @INTERNAL
+# @DESCRIPTION:
+# Post-phase function called after python_compile. In PEP517 mode,
+# it adjusts the install tree for venv-style usage.
+_distutils-r1_post_python_compile() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ local root=${BUILD_DIR}/install
+ if [[ ${DISTUTILS_USE_PEP517} && -d ${root} ]]; then
+ # copy executables to python-exec directory
+ # we do it early so that we can alter bindir recklessly
+ local bindir=${root}${EPREFIX}/usr/bin
+ local rscriptdir=${root}$(python_get_scriptdir)
+ [[ -d ${rscriptdir} ]] &&
+ die "${rscriptdir} should not exist!"
+ if [[ -d ${bindir} ]]; then
+ mkdir -p "${rscriptdir}" || die
+ cp -a --reflink=auto "${bindir}"/. "${rscriptdir}"/ || die
+ fi
+
+ # enable venv magic inside the install tree
+ mkdir -p "${bindir}" || die
+ ln -s "${PYTHON}" "${bindir}/${EPYTHON}" || die
+ ln -s "${EPYTHON}" "${bindir}/python3" || die
+ ln -s "${EPYTHON}" "${bindir}/python" || die
+ cat > "${bindir}"/pyvenv.cfg <<-EOF || die
+ include-system-site-packages = true
+ EOF
+
+ # we need to change shebangs to point to the venv-python
+ find "${bindir}" -type f -exec sed -i \
+ -e "1s@^#!\(${EPREFIX}/usr/bin/\(python\|pypy\)\)@#!${root}\1@" \
+ {} + || die
+ fi
+}
+
distutils-r1_src_compile() {
debug-print-function ${FUNCNAME} "${@}"
local ret=0