Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 1/4] python3-pip-native: install scripts in ${bindir}
@ 2022-02-23 22:09 Tim Orling
  2022-02-23 22:09 ` [PATCH 2/4] python3-scons-native: drop from maintainers.inc Tim Orling
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Tim Orling @ 2022-02-23 22:09 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tim Orling

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() {
     install -d ${D}${PYTHON_SITEPACKAGES_DIR}
     unzip -d ${D}${PYTHON_SITEPACKAGES_DIR} ${PYPA_WHEEL} || \
     bbfatal_log "Failed to unzip wheel: ${PYPA_WHEEL}. Check the logs."
+
+    # pip install would normally generate [console_scripts] in ${bindir}
+    install -d ${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}
+#!/bin/sh
+'''exec' ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} "\$0" "\$@"
+' '''
+# -*- 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
+    chmod 0755 ${D}${bindir}/pip3 ${D}${bindir}/pip${PYTHON_BASEVERSION}
 }
 
 do_install:append() {
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-02-24  0:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [OE-core] [PATCH 1/4] python3-pip-native: install scripts in ${bindir} Peter Kjellerstedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox