summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2022-01-13 10:44:35 +0100
committerMichał Górny <mgorny@gentoo.org>2022-01-16 18:40:48 +0100
commit6254913777f1562b9d614be1ace2795b4e9106f8 (patch)
treec1d3c474734a64da94532742edf027be413608d2 /eclass
parentmultibuild.eclass: remove EAPI 4 and 5 (diff)
downloadgentoo-6254913777f1562b9d614be1ace2795b4e9106f8.tar.gz
gentoo-6254913777f1562b9d614be1ace2795b4e9106f8.tar.bz2
gentoo-6254913777f1562b9d614be1ace2795b4e9106f8.zip
distutils-r1.eclass: Minimize & unify dift --via-venv logic
Modify `distutils_install_for_testing --via-venv` to create a minimal venv manually rather than relying on Python to do so. Use root-style install rather than the egg-style to improve consistency with regular installs. This is a step towards unifying different install layouts used within the eclass. Right now we support three different variants for testing: 1. The build-dir layout that's created by python_compile() and exposed unconditionally through PYTHONPATH. 2. The --via-root layout of dift that resembles install closer (primarily through including package metadata) and also uses PYTHONPATH. 3. The --via-venv layout of dift that creates a venv and installs the packages there. It requires only PATH, not PYTHONPATH. The last layout is the newest and probably the most compatible but it requires additional install step. Since the PEP517 build logic is going to require installing a wheel anyway, the plan is to inject a minimal venv into the staging directory and use it unconditionally for tests. The purpose of this patch is to prepare a single code snippet that will be used both by dift and the new logic logic. Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/distutils-r1.eclass16
1 files changed, 14 insertions, 2 deletions
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 7bd9baba8167..074a611c84dd 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -554,14 +554,26 @@ distutils_install_for_testing() {
local add_args=()
if [[ ${install_method} == venv ]]; then
- "${EPYTHON}" -m venv --system-site-packages --without-pip \
- "${TEST_DIR}" || die
+ # create a quasi-venv
+ mkdir -p "${TEST_DIR}"/bin || die
+ ln -s "${PYTHON}" "${TEST_DIR}/bin/${EPYTHON}" || die
+ ln -s "${EPYTHON}" "${TEST_DIR}/bin/python3" || die
+ ln -s "${EPYTHON}" "${TEST_DIR}/bin/python" || die
+ cat > "${TEST_DIR}"/pyvenv.cfg <<-EOF || die
+ include-system-site-packages = true
+ EOF
# we only do the minimal necessary subset of activate script
PATH=${TEST_DIR}/bin:${PATH}
# unset PYTHONPATH in order to prevent BUILD_DIR from overriding
# venv packages
unset PYTHONPATH
+
+ # force root-style install (note: venv adds TEST_DIR to prefixes,
+ # so we need to pass --root=/)
+ add_args=(
+ --root=/
+ )
else
local bindir=${TEST_DIR}/scripts
local libdir=${TEST_DIR}/lib