From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: "Michał Górny" <mgorny@gentoo.org>
Subject: [gentoo-dev] [PATCH 2/7] distutils-r1.eclass: Pass options to meson-python backend
Date: Fri, 25 Nov 2022 18:05:03 +0100 [thread overview]
Message-ID: <20221125170508.23064-3-mgorny@gentoo.org> (raw)
In-Reply-To: <20221125170508.23064-1-mgorny@gentoo.org>
Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
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
next prev parent reply other threads:[~2022-11-25 17:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-25 17:05 [gentoo-dev] [PATCH 0/7] distutils-r1.eclass: mesonpy option passing support + periodic cleanup Michał Górny
2022-11-25 17:05 ` [gentoo-dev] [PATCH 1/7] ninja-utils.eclass: Split get_NINJAOPTS out Michał Górny
2022-11-25 17:05 ` Michał Górny [this message]
2022-11-25 17:05 ` [gentoo-dev] [PATCH 3/7] dev-python/scipy: Pass -Dblas, -Dlapack via DISTUTILS_ARGS Michał Górny
2022-11-25 17:05 ` [gentoo-dev] [PATCH 4/7] distutils-r1.eclass: Bump min dep versions to newest stable Michał Górny
2022-11-25 17:05 ` [gentoo-dev] [PATCH 5/7] distutils-r1.eclass: Print versions of common hatch plugins Michał Górny
2022-11-25 17:05 ` [gentoo-dev] [PATCH 6/7] distutils-r1.eclass: Remove support for gpep517 < 9 Michał Górny
2022-11-25 17:05 ` [gentoo-dev] [PATCH 7/7] python-utils-r1.eclass: Bump min Python versions Michał Górny
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221125170508.23064-3-mgorny@gentoo.org \
--to=mgorny@gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox