public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: James Le Cuirot <chewi@gentoo.org>
Subject: Re: [gentoo-dev] [PATCH v2] python-utils-r1.eclass: Fix PYTHON_SITEDIR/INCLUDEDIR for cross-prefix
Date: Wed, 16 Aug 2023 12:47:05 +0200	[thread overview]
Message-ID: <da3ae69aa18c1af8f597981f4cf2b22ed4b4f6c2.camel@gentoo.org> (raw)
In-Reply-To: <20230816064604.11064-1-chewi@gentoo.org>

On Wed, 2023-08-16 at 07:39 +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.
> 
> 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.
> 
> 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.
> 
> ${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.
> 
> Signed-off-by: James Le Cuirot <chewi@gentoo.org>
> ---
> 
> Note that gpep517 also needs the same treatment, but I'll handle that
> later. This at least allows Portage itself to be installed.
> 
>  eclass/python-utils-r1.eclass | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
> index 2fffd6d56bf5..abfb74832f30 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="${EPREFIX}${PYTHON_SITEDIR#${BROOT-${EPREFIX}}}"
>  				export PYTHON_SITEDIR
>  				debug-print "${FUNCNAME}: PYTHON_SITEDIR = ${PYTHON_SITEDIR}"
>  				;;
> @@ -362,6 +363,7 @@ _python_export() {
>  						print(sysconfig.get_path("platinclude"))
>  					EOF
>  				)
> +				PYTHON_INCLUDEDIR="${ESYSROOT}${PYTHON_INCLUDEDIR#${BROOT-${EPREFIX}}}"
>  				export PYTHON_INCLUDEDIR
>  				debug-print "${FUNCNAME}: PYTHON_INCLUDEDIR = ${PYTHON_INCLUDEDIR}"
> 
> 

You don't seem to have changed that, actually.

-- 
Best regards,
Michał Górny



  reply	other threads:[~2023-08-16 10:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-16  6:39 [gentoo-dev] [PATCH v2] python-utils-r1.eclass: Fix PYTHON_SITEDIR/INCLUDEDIR for cross-prefix James Le Cuirot
2023-08-16 10:47 ` Michał Górny [this message]
2023-08-16 12:12   ` James Le Cuirot

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=da3ae69aa18c1af8f597981f4cf2b22ed4b4f6c2.camel@gentoo.org \
    --to=mgorny@gentoo.org \
    --cc=chewi@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