From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 4FAAC158020 for ; Fri, 25 Nov 2022 17:05:59 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 749F3E09D8; Fri, 25 Nov 2022 17:05:17 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 26E00E0992 for ; Fri, 25 Nov 2022 17:05:17 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-dev@lists.gentoo.org Cc: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [gentoo-dev] [PATCH 2/7] distutils-r1.eclass: Pass options to meson-python backend Date: Fri, 25 Nov 2022 18:05:03 +0100 Message-Id: <20221125170508.23064-3-mgorny@gentoo.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221125170508.23064-1-mgorny@gentoo.org> References: <20221125170508.23064-1-mgorny@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Archives-Salt: e65e0562-b30c-49b9-ae58-70c2cf3d1eba X-Archives-Hash: a912af3bafa59a9f3d60a5a2502556f1 Signed-off-by: Michał Górny --- eclass/distutils-r1.eclass | 50 +++++++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 11 deletions(-) diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass index 4cc117dfbd54..3ac06a458483 100644 --- a/eclass/distutils-r1.eclass +++ b/eclass/distutils-r1.eclass @@ -178,7 +178,7 @@ esac if [[ ! ${_DISTUTILS_R1} ]]; then [[ ${EAPI} == 6 ]] && inherit eutils xdg-utils -inherit multibuild multiprocessing toolchain-funcs +inherit multibuild multiprocessing ninja-utils toolchain-funcs if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then inherit python-r1 @@ -1319,9 +1319,34 @@ distutils_pep517_install() { fi local config_settings= - if [[ -n ${DISTUTILS_ARGS[@]} ]]; then - case ${DISTUTILS_USE_PEP517} in - setuptools) + case ${DISTUTILS_USE_PEP517} in + meson-python) + # TODO: remove the condition once we BDEP on >=0.11 + if has_version -b ">=dev-python/meson-python-0.11"; then + local -x NINJAOPTS=$(get_NINJAOPTS) + config_settings=$( + "${EPYTHON}" - "${DISTUTILS_ARGS[@]}" <<-EOF || die + import json + import os + import shlex + import sys + + ninjaopts = shlex.split(os.environ["NINJAOPTS"]) + print(json.dumps({ + "setup-args": sys.argv[1:], + "compile-args": [ + "-v", + f"--ninja-args={ninjaopts!r}", + ], + })) + EOF + ) + elif [[ -n ${DISTUTILS_ARGS[@]} ]]; then + die "DISTUTILS_ARGS requires >=dev-python/meson-python-0.11 (missing BDEP?)" + fi + ;; + setuptools) + if [[ -n ${DISTUTILS_ARGS[@]} ]]; then config_settings=$( "${EPYTHON}" - "${DISTUTILS_ARGS[@]}" <<-EOF || die import json @@ -1329,8 +1354,10 @@ distutils_pep517_install() { print(json.dumps({"--global-option": sys.argv[1:]})) EOF ) - ;; - sip) + fi + ;; + sip) + if [[ -n ${DISTUTILS_ARGS[@]} ]]; then # NB: for practical reasons, we support only --foo=bar, # not --foo bar local arg @@ -1353,12 +1380,13 @@ distutils_pep517_install() { print(json.dumps(args)) EOF ) - ;; - *) + fi + ;; + *) + [[ -n ${DISTUTILS_ARGS[@]} ]] && die "DISTUTILS_ARGS are not supported by ${DISTUTILS_USE_PEP517}" - ;; - esac - fi + ;; + esac local build_backend=$(_distutils-r1_get_backend) einfo " Building the wheel for ${PWD#${WORKDIR}/} via ${build_backend}" -- 2.38.1