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 E2BB915800A for ; Sat, 19 Aug 2023 18:28:04 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id F2B7A2BC021; Sat, 19 Aug 2023 18:28:00 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (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 9FEB32BC016 for ; Sat, 19 Aug 2023 18:28:00 +0000 (UTC) Message-ID: <45cc79f86da34369273b9e7f7e0a8bfc5c0d1cf2.camel@gentoo.org> Subject: Re: [gentoo-dev] [PATCH v3] python-utils-r1.eclass: Fix PYTHON_SITEDIR/INCLUDEDIR for cross-prefix From: =?UTF-8?Q?Micha=C5=82_G=C3=B3rny?= To: gentoo-dev@lists.gentoo.org Cc: James Le Cuirot Date: Sat, 19 Aug 2023 20:27:56 +0200 In-Reply-To: <20230816121727.15902-1-chewi@gentoo.org> References: <20230816121727.15902-1-chewi@gentoo.org> Organization: Gentoo Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.4 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 X-Archives-Salt: 4aa3974f-6281-4047-a41b-04bea249c22b X-Archives-Hash: 598b706e31bf7b5908fa9f359c0a61e1 On Wed, 2023-08-16 at 13:16 +0100, James Le Cuirot wrote: > We dynamically determine Python's SITEDIR and INCLUDEDIR using the build > host's Python. This breaks down when the build host's prefix differs > from the target host's prefix, so chop off the former and prepend the > latter. >=20 > This assumes that each Python implementation is always installed using > the same scheme. Meson already makes this assumption, and gpep517 makes > a similar assumption to determine Python's stdlib location. >=20 > We could improve on this and determine these locations using SYSROOT's > sysconfigdata file, like gpep517 does, but this seems needlessly > complex. We would need to take this approach for PYTHON_LIBPATH and > PYTHON_CONFIG, but these are only used by handful of packages. >=20 > ${BROOT-${EPREFIX}} is needed rather than plain ${BROOT} for the same > reason we need it for PYTHON, namely that Portage <3.0.50 was buggy. >=20 > Signed-off-by: James Le Cuirot > --- >=20 > Note that gpep517 also needs the same treatment, but I'll handle that > later. This at least allows Portage itself to be installed. >=20 > eclass/python-utils-r1.eclass | 2 ++ > 1 file changed, 2 insertions(+) >=20 > diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclas= s > index 2fffd6d56bf5..f9c6d161d3f3 100644 > --- a/eclass/python-utils-r1.eclass > +++ b/eclass/python-utils-r1.eclass > @@ -351,6 +351,7 @@ _python_export() { > print(sysconfig.get_path("purelib")) > EOF > ) > + PYTHON_SITEDIR=3D${EPREFIX}${PYTHON_SITEDIR#"${BROOT-${EPREFIX}}"} > export PYTHON_SITEDIR > debug-print "${FUNCNAME}: PYTHON_SITEDIR =3D ${PYTHON_SITEDIR}" > ;; > @@ -362,6 +363,7 @@ _python_export() { > print(sysconfig.get_path("platinclude")) > EOF > ) > + PYTHON_INCLUDEDIR=3D${ESYSROOT}${PYTHON_INCLUDEDIR#"${BROOT-${EPREFI= X}}"} > export PYTHON_INCLUDEDIR > debug-print "${FUNCNAME}: PYTHON_INCLUDEDIR =3D ${PYTHON_INCLUDEDIR}= " >=20 > -- > 2.41.0 >=20 Pushed (along with some other pending changes), thanks! --=20 Best regards, Micha=C5=82 G=C3=B3rny