Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH 2/4] distutils-r1.eclass: Pass --sysroot to gpep517 when cross-compiling
Date: Mon, 12 Dec 2022 06:20:06
Message-Id: 20221212061922.46687-3-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCH 0/4] distutils-r1.eclass: cross support + minor updates by "Michał Górny"
1 Signed-off-by: Michał Górny <mgorny@g.o>
2 ---
3 eclass/distutils-r1.eclass | 19 ++++++++++++++-----
4 1 file changed, 14 insertions(+), 5 deletions(-)
5
6 diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
7 index 6e8ff5467bdb..371d52bcb7ef 100644
8 --- a/eclass/distutils-r1.eclass
9 +++ b/eclass/distutils-r1.eclass
10 @@ -1033,6 +1033,11 @@ distutils-r1_python_prepare_all() {
11 python_export_utf8_locale
12 _distutils-r1_print_package_versions
13
14 + if [[ -n ${SYSROOT} ]] && ! has_version -b ">=dev-python/gpep517-12"; then
15 + ewarn ">=dev-python/gpep517-12 features cross-compilation fixes."
16 + ewarn "Please consider upgrading to avoid issues."
17 + fi
18 +
19 _DISTUTILS_DEFAULT_CALLED=1
20 }
21
22 @@ -1356,16 +1361,18 @@ distutils_pep517_install() {
23
24 local build_backend=$(_distutils-r1_get_backend)
25 einfo " Building the wheel for ${PWD#${WORKDIR}/} via ${build_backend}"
26 - local config_args=()
27 - [[ -n ${config_settings} ]] &&
28 - config_args+=( --config-json "${config_settings}" )
29 local cmd=(
30 gpep517 build-wheel
31 --backend "${build_backend}"
32 --output-fd 3
33 --wheel-dir "${WHEEL_BUILD_DIR}"
34 - "${config_args[@]}"
35 )
36 + if [[ -n ${config_settings} ]]; then
37 + cmd+=( --config-json "${config_settings}" )
38 + fi
39 + if [[ -n ${SYSROOT} ]] && has_version -b ">=dev-python/gpep517-12"; then
40 + cmd+=( --sysroot "${SYSROOT}" )
41 + fi
42 printf '%s\n' "${cmd[*]}"
43 local wheel=$(
44 "${cmd[@]}" 3>&1 >&2 || die "Wheel build failed"
45 @@ -1428,7 +1435,9 @@ distutils-r1_python_compile() {
46 #
47 # see extension.py for list of suffixes
48 # .pyx is added for Cython
49 - if [[ 1 -ne ${jobs} && 2 -eq $(
50 + #
51 + # esetup.py does not respect SYSROOT, so skip it there
52 + if [[ -z ${SYSROOT} && 1 -ne ${jobs} && 2 -eq $(
53 find '(' -name '*.c' -o -name '*.cc' -o -name '*.cpp' \
54 -o -name '*.cxx' -o -name '*.c++' -o -name '*.m' \
55 -o -name '*.mm' -o -name '*.pyx' ')' -printf '\n' |
56 --
57 2.38.2