summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2020-09-22 09:32:33 +0200
committerMichał Górny <mgorny@gentoo.org>2020-09-22 09:33:52 +0200
commit697ade8b8aa51f6bba030a1c01c1f9896f3d7719 (patch)
tree31db75ea7e2b4609d4adaa939380c69b3ec33a7e /metadata
parentwww-client/chromium: stable channel bump to 85.0.4183.121 (diff)
downloadgentoo-697ade8b8aa51f6bba030a1c01c1f9896f3d7719.tar.gz
gentoo-697ade8b8aa51f6bba030a1c01c1f9896f3d7719.tar.bz2
gentoo-697ade8b8aa51f6bba030a1c01c1f9896f3d7719.zip
install-qa-check.d: Simply DISTUTILS_USE_SETUPTOOLS logic
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'metadata')
-rw-r--r--metadata/install-qa-check.d/60distutils-use-setuptools49
1 files changed, 24 insertions, 25 deletions
diff --git a/metadata/install-qa-check.d/60distutils-use-setuptools b/metadata/install-qa-check.d/60distutils-use-setuptools
index 551cb0f0b6cb..0a1688a83c5e 100644
--- a/metadata/install-qa-check.d/60distutils-use-setuptools
+++ b/metadata/install-qa-check.d/60distutils-use-setuptools
@@ -5,8 +5,6 @@
# Maintainer: Python project <python@gentoo.org>
get_expected_distutils_use_setuptools() {
- [[ ${integrity_error_new} ]] && return 1
-
local sitedir=${D}$(python_get_sitedir)
local egg new_expected
while read -d $'\0' -r egg; do
@@ -25,18 +23,8 @@ get_expected_distutils_use_setuptools() {
new_expected=bdepend
fi
- if [[ ${expected} && ${new_expected} != ${expected} ]]; then
- if [[ ${expected}${new_expected} == [br]depend[br]depend ]]
- then
- # packages can have scripts that are installed
- # conditionally to implementation
- expected=rdepend
- else
- integrity_error_new=${new_expected}
- return 1
- fi
- else
- expected=${new_expected}
+ if ! has "${new_expected}" "${expected[@]}"; then
+ expected+=( "${new_expected[@]}" )
fi
done < <(find "${sitedir}" -name '*.egg-info' -print0)
}
@@ -49,21 +37,32 @@ distutils_use_setuptools_check() {
# pyproject.toml is verified by using it
[[ ${DISTUTILS_USE_SETUPTOOLS} == pyproject.toml ]] && return
- local expected integrity_error_new
+ local expected=()
_distutils-r1_run_foreach_impl get_expected_distutils_use_setuptools
- if [[ ${integrity_error_new} ]]; then
- eerror "DISTUTILS_USE_SETUPTOOLS integrity error!"
- eerror "expected was: ${expected}"
- eerror "new_expected is: ${integrity_error_new}"
+ # at this point, expected can contain: no bdepend rdepend
+ if [[ ${#expected[@]} -eq 0 ]]; then
+ eerror "No .egg-info found. Please report a bug and CC python@"
+ elif [[ ${#expected[@]} -gt 1 ]] && has no "${expected[@]}"; then
+ # 'no' and '[rb]depend' are mutually exclusive
+ eerror "The package seems to have used distutils and setuptools simultaneously."
+ eerror "This could mean the package has bad conditions:"
+ eerror "https://dev.gentoo.org/~mgorny/python-guide/distutils.html#conditional-distutils-setuptools-use-in-packages"
eerror "Please report a bug about this and CC python@"
- elif [[ ${DISTUTILS_USE_SETUPTOOLS} != ${expected} ]]; then
- local def=
- [[ ${DISTUTILS_USE_SETUPTOOLS} == bdepend ]] && def=' (or unset)'
+ else
+ # bdepend+rdepend=rdepend
+ has rdepend "${expected[@]}" && expected=( rdepend )
+ # at this point, expected should have exactly one value
+ [[ ${#expected[@]} -eq 1 ]] || die "integrity error"
- eqawarn "DISTUTILS_USE_SETUPTOOLS value is probably incorrect"
- eqawarn " have: DISTUTILS_USE_SETUPTOOLS=${DISTUTILS_USE_SETUPTOOLS}${def}"
- eqawarn " expected: DISTUTILS_USE_SETUPTOOLS=${expected}"
+ if [[ ${DISTUTILS_USE_SETUPTOOLS} != ${expected} ]]; then
+ local def=
+ [[ ${DISTUTILS_USE_SETUPTOOLS} == bdepend ]] && def=' (or unset)'
+
+ eqawarn "DISTUTILS_USE_SETUPTOOLS value is probably incorrect"
+ eqawarn " have: DISTUTILS_USE_SETUPTOOLS=${DISTUTILS_USE_SETUPTOOLS}${def}"
+ eqawarn " expected: DISTUTILS_USE_SETUPTOOLS=${expected}"
+ fi
fi
}