From: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
To: Tim Orling <ticotimo@gmail.com>,
"openembedded-core@lists.openembedded.org"
<openembedded-core@lists.openembedded.org>
Cc: Tim Orling <tim.orling@konsulko.com>
Subject: RE: [OE-core] [PATCH 1/4] python3-pip-native: install scripts in ${bindir}
Date: Thu, 24 Feb 2022 00:30:14 +0000 [thread overview]
Message-ID: <a5ede526a7de42fb9628a11ef7253051@axis.com> (raw)
In-Reply-To: <20220223220913.2057644-1-tim.orling@konsulko.com>
> -----Original Message-----
> From: openembedded-core@lists.openembedded.org <openembedded-
> core@lists.openembedded.org> On Behalf Of Tim Orling
> Sent: den 23 februari 2022 23:09
> To: openembedded-core@lists.openembedded.org
> Cc: Tim Orling <tim.orling@konsulko.com>
> Subject: [OE-core] [PATCH 1/4] python3-pip-native: install scripts in
> ${bindir}
>
> The naïve approach of simply unzipping the built wheel is not
> sufficient. 'pip install' would normally have created the
> [console_scripts] from entry-points.txt in ${D}${bindir}.
>
> For bootstrapping purposes, hardcode the scripts and install them into
> ${D}${bindir}. Skip the ${bindir}/pip variant.
>
> [YOCTO #14739]
>
> Signed-off-by: Tim Orling <tim.orling@konsulko.com>
> ---
> .../python/python3-pip_22.0.3.bb | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/meta/recipes-devtools/python/python3-pip_22.0.3.bb
> b/meta/recipes-devtools/python/python3-pip_22.0.3.bb
> index 482a210ee99..5a77cb72d70 100644
> --- a/meta/recipes-devtools/python/python3-pip_22.0.3.bb
> +++ b/meta/recipes-devtools/python/python3-pip_22.0.3.bb
> @@ -23,6 +23,23 @@ do_install:class-native() {
For the record, OE-Core uses tabs to indent shell code,
compared to OpenEmbedded, which uses four spaces...
> install -d ${D}${PYTHON_SITEPACKAGES_DIR}
> unzip -d ${D}${PYTHON_SITEPACKAGES_DIR} ${PYPA_WHEEL} || \
There is no reason for the backslash at the end of the line above.
However, the line below should be indented to indicate that it is
a continuation of the line above,
> bbfatal_log "Failed to unzip wheel: ${PYPA_WHEEL}. Check the logs."
> +
> + # pip install would normally generate [console_scripts] in ${bindir}
> + install -d ${D}/${bindir}
Change "${D}/${bindir}" to "${D}${bindir}".
> + # We will skip the ${bindir}/pip variant as we would just remove it in the do_install:append
> + cat << EOF >> ${D}/${bindir}/pip3 | tee ${D}/${bindir}/pip${PYTHON_BASEVERSION}
Change the above to:
cat << EOF > pip3
or even better would be:
cat <<-EOF > pip3
as you then can indent the code below.
And the creation of the file belongs in do_compile:class-native()
instead.
> +#!/bin/sh
> +'''exec' ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} "\$0" "\$@"
> +' '''
What's the reason for the above construct? Why doesn't this work:
#!${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN}
If it doesn't, then there should be a comment explaining what's
going on.
> +# -*- coding: utf-8 -*-
> +import re
> +import sys
> +from pip._internal.cli.main import main
> +if __name__ == '__main__':
> + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
> + sys.exit(main())
> +EOF
Isn't the code for pip3 available somewhere in the source code
so it could be copied from there instead? What happens if
upstream decides to change the implementation of pip3?
> + chmod 0755 ${D}${bindir}/pip3 ${D}${bindir}/pip${PYTHON_BASEVERSION}
Change the above to:
install pip3 ${D}${bindir}
install pip3 ${D}${bindir}/pip${PYTHON_BASEVERSION}
> }
>
> do_install:append() {
> --
> 2.30.2
Most of the above comments also apply to the patch for
python3-wheel-native.
//Peter
prev parent reply other threads:[~2022-02-24 0:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-23 22:09 [PATCH 1/4] python3-pip-native: install scripts in ${bindir} Tim Orling
2022-02-23 22:09 ` [PATCH 2/4] python3-scons-native: drop from maintainers.inc Tim Orling
2022-02-23 22:09 ` [PATCH 3/4] python3-flit-core: SUMMARY DESCRIPTION HOMEPAGE Tim Orling
2022-02-23 22:09 ` [PATCH 4/4] python3-wheel-native: install ${bindir}/wheel Tim Orling
2022-02-24 0:30 ` Peter Kjellerstedt [this message]
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=a5ede526a7de42fb9628a11ef7253051@axis.com \
--to=peter.kjellerstedt@axis.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=ticotimo@gmail.com \
--cc=tim.orling@konsulko.com \
/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