summaryrefslogtreecommitdiff
path: root/eclass/distutils-r1.eclass
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2023-02-25 09:51:58 +0000
committerV3n3RiX <venerix@koprulu.sector>2023-02-25 09:51:58 +0000
commitbaeb826318951e5c82b18c1e9ee120ac5dcf0b94 (patch)
tree7154de118466f928d847a0659795c3f84c116096 /eclass/distutils-r1.eclass
parent1e17db840dfd2f8b2b43a0a385c106812ebcfea9 (diff)
gentoo auto-resync : 25:02:2023 - 09:51:58
Diffstat (limited to 'eclass/distutils-r1.eclass')
-rw-r--r--eclass/distutils-r1.eclass34
1 files changed, 33 insertions, 1 deletions
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index e95047e3a1f0..9ef8342486b4 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -1331,7 +1331,7 @@ distutils_pep517_install() {
"${EPYTHON}" - "${DISTUTILS_ARGS[@]}" <<-EOF || die
import json
import sys
- print(json.dumps({"--global-option": sys.argv[1:]}))
+ print(json.dumps({"--build-option": sys.argv[1:]}))
EOF
)
fi
@@ -1980,6 +1980,36 @@ distutils-r1_src_test() {
return ${ret}
}
+# @FUNCTION: _distutils-r1_strip_namespace_packages
+# @USAGE: <sitedir>
+# @INTERNAL
+# @DESCRIPTION:
+# Find and remove setuptools-style namespaces in the specified
+# directory.
+_distutils-r1_strip_namespace_packages() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ local sitedir=${1}
+ local f ns had_any=
+ while IFS= read -r -d '' f; do
+ while read -r ns; do
+ einfo "Stripping pkg_resources-style namespace ${ns}"
+ had_any=1
+ done < "${f}"
+
+ rm "${f}" || die
+ done < <(
+ # NB: this deliberately does not include .egg-info, in order
+ # to limit this to PEP517 mode.
+ find "${sitedir}" -path '*.dist-info/namespace_packages.txt' -print0
+ )
+
+ # If we had any namespace packages, remove .pth files as well.
+ if [[ ${had_any} ]]; then
+ find "${sitedir}" -name '*-nspkg.pth' -delete || die
+ fi
+}
+
# @FUNCTION: _distutils-r1_post_python_install
# @INTERNAL
# @DESCRIPTION:
@@ -1990,6 +2020,8 @@ _distutils-r1_post_python_install() {
local sitedir=${D%/}$(python_get_sitedir)
if [[ -d ${sitedir} ]]; then
+ _distutils-r1_strip_namespace_packages "${sitedir}"
+
local forbidden_package_names=(
examples test tests
.pytest_cache .hypothesis _trial_temp