distutils-r1.eclass: fix sip on musl with gpep517 --verify-tags

"manylinux" is rightfullly not in supported sys_tags() on a musl system
and `gpep517 --verify-tags` rejects it causing an install failure.

This changes e.g.
    pyqt6-6.11.0-cp310-abi3-manylinux_2_34_x86_64.whl
to
    pyqt6-6.11.0-cp310-abi3-linux_x86_64.whl
which is accepted for both musl and glibc, so we can do this
unconditionally and may be useful for other exotic configurations
beside musl.

Actual new code is just the sip_args=() and replacing DISTUTILS_ARGS,
the rest is just indenting changes given we don't need to check if
DISTUTILS_ARGS is empty anymore.

Using a separate sip_args (like maturin_args) to keep DISTUTILS_ARGS
as-is and prevent incrementing if called multiple times. fwiw not using
sip_args for the argument sanity check loop so it doesn't check static
eclass arguments for nothing, not that it matters much.

Signed-off-by: Ionen Wolkens <ionen@gentoo.org>
This commit is contained in:
Ionen Wolkens
2026-09-03 17:38:21 -04:00
parent 266ba55da9
commit e479cb3f2b
+27 -21
View File
@@ -1120,30 +1120,36 @@ distutils_pep517_install() {
fi
;;
sip)
if [[ -n ${DISTUTILS_ARGS[@]} ]]; then
# NB: for practical reasons, we support only --foo=bar,
# not --foo bar
local arg
for arg in "${DISTUTILS_ARGS[@]}"; do
[[ ${arg} != -* ]] &&
die "Bare arguments in DISTUTILS_ARGS unsupported: ${arg}"
done
# NB: for practical reasons, we support only --foo=bar,
# not --foo bar
local arg
for arg in "${DISTUTILS_ARGS[@]}"; do
[[ ${arg} != -* ]] &&
die "Bare arguments in DISTUTILS_ARGS unsupported: ${arg}"
done
config_settings=$(
"${EPYTHON}" - "${DISTUTILS_ARGS[@]}" <<-EOF || die
import collections
import json
import sys
local sip_args=(
# sip adds manylinux to tags by default which is wrong
# without a curated environment and causes problems on
# musl with gpep517's --verify-tags
--no-manylinux
"${DISTUTILS_ARGS[@]}"
)
args = collections.defaultdict(list)
for arg in (x.split("=", 1) for x in sys.argv[1:]): \
args[arg[0]].extend(
[arg[1]] if len(arg) > 1 else [])
config_settings=$(
"${EPYTHON}" - "${sip_args[@]}" <<-EOF || die
import collections
import json
import sys
print(json.dumps(args))
EOF
)
fi
args = collections.defaultdict(list)
for arg in (x.split("=", 1) for x in sys.argv[1:]): \
args[arg[0]].extend(
[arg[1]] if len(arg) > 1 else [])
print(json.dumps(args))
EOF
)
;;
*)
[[ -n ${DISTUTILS_ARGS[@]} ]] &&