> On 8 May 2022, at 19:27, Michał Górny <[email protected]> wrote: > > Use gpep517 --config-json support to pass DISTUTILS_ARGS in PEP517 mode. > > Signed-off-by: Michał Górny <[email protected]> > --- > eclass/distutils-r1.eclass | 32 +++++++++++++++++++++++++++----- > 1 file changed, 27 insertions(+), 5 deletions(-) > > diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass > index 1573d803f3f6..e9a28056e9cc 100644 > --- a/eclass/distutils-r1.eclass > +++ b/eclass/distutils-r1.eclass > @@ -1091,12 +1091,38 @@ distutils_pep517_install() { > local -x WHEEL_BUILD_DIR=${BUILD_DIR}/wheel > mkdir -p "${WHEEL_BUILD_DIR}" || die > > + if [[ -n ${mydistutilsargs[@]} ]]; then > + die "mydistutilsargs are banned in PEP517 mode (use > DISTUTILS_ARGS)" > + fi > + > + local config_settings= > + if [[ -n ${DISTUTILS_ARGS[@]} ]]; then > + case ${DISTUTILS_USE_PEP517} in > + setuptools) > + config_settings=$( > + "${EPYTHON}" - "${DISTUTILS_ARGS[@]}" > <<-EOF || die > + import json > + import sys > + > print(json.dumps({"--global-option": sys.argv[1:]})) > + EOF > + ) > + ;; > + *) > + die "DISTUTILS_ARGS are not supported by > ${DISTUTILS_USE_PEP517}"
I'd do DISTUTILS_USE_PEP517=${...}, but I don't feel super strongly about it.
... and also Python guide update.
> + ;;
> + esac
> + fi
> +
> local build_backend=$(_distutils-r1_get_backend)
> einfo " Building the wheel for ${PWD#${WORKDIR}/} via ${build_backend}"
> + local config_args=()
> + [[ -n ${config_settings} ]] &&
> + config_args+=( --config-json "${config_settings}" )
> local wheel=$(
> gpep517 build-wheel --backend "${build_backend}" \
> --output-fd 3 \
> - --wheel-dir "${WHEEL_BUILD_DIR}" 3>&1 >&2 ||
> + --wheel-dir "${WHEEL_BUILD_DIR}" \
> + "${config_args[@]}" 3>&1 >&2 ||
> die "Wheel build failed"
> )
> [[ -n ${wheel} ]] || die "No wheel name returned"
> @@ -1181,10 +1207,6 @@ distutils-r1_python_compile() {
> esac
>
> if [[ ${DISTUTILS_USE_PEP517} ]]; then
> - if [[ -n ${DISTUTILS_ARGS[@]} || -n ${mydistutilsargs[@]} ]];
> then
> - die "DISTUTILS_ARGS are not supported in PEP-517 mode"
> - fi
> -
> # python likes to compile any module it sees, which triggers
> sandbox
> # failures if some packages haven't compiled their modules yet.
> addpredict "${EPREFIX}/usr/lib/${EPYTHON}"
> --
> 2.35.1
>
>
signature.asc
Description: Message signed with OpenPGP
