• [gentoo-dev] [PATCH] distutils-r1.eclass: Support DISTUTILS_ARGS in PEP

    From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Sun May 8 20:30:01 2022
    Use gpep517 --config-json support to pass DISTUTILS_ARGS in PEP517 mode.

    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    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}"
    + ;;
    + esac
    + fi
    +
    local buil
  • From Sam James@21:1/5 to All on Mon May 9 01:20:02 2022
    On 8 May 2022, at 19:27, Michał Górny <mgorny@gentoo.org> wrote:

    Use gpep517 --config-json support to pass DISTUTILS_ARGS in PEP517 mode.

    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    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




    -----BEGIN PGP SIGNATURE-----

    iQGTBAEBCgB9FiEEYOpPv/uDUzOcqtTy9JIoEO6gSDsFAmJ4TqFfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDYw RUE0RkJGRkI4MzUzMzM5Q0FBRDRGMkY0OTIyODEwRUVBMDQ4M0IACgkQ9JIoEO6g SDvnEwf/QqXNt35OHJ9xZbUkRs/n4SbessfaBka1GhtYAUo88aJa6FCSXEu+63D6 tOdSN9zEI3buXg++9La2QauNUiKjDeZdzTidPGcffJzjGJ3obEyJfNoclhmcbGja nsGXMqlXnMKMlJbUtv2wsBzaTsrL8k7KAZPpAhOOq2vqGewX6crRFW2KBsRYNxtO C46DQwBhUR672/TygfM6TYkBdwaqAPkoFXeH0fguNsmZup9Q22+0Zzpsx/N80mwt zIimWq4iR3QgiHuO73jlf6nCdfy043Sai4ssaSYeN7FoUI8kfSCXN+Xc0MfrUNwn WatokintYAnJ4VnBPldiPJ/x5RrI4g==
    =CKKJ
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)