summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Orling <ticotimo@gmail.com>2022-02-23 14:09:10 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-02-25 15:06:46 +0000
commit5b58328b610273fea42c144cd590e638c0dc1e4e (patch)
tree81edd71b600fec6926a0f42b6dc07750bb6febd3
parent8ceb0bec18422818dcdb0efecec08ed155dc4715 (diff)
downloadopenembedded-core-contrib-5b58328b610273fea42c144cd590e638c0dc1e4e.tar.gz
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> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/python/python3-pip_22.0.3.bb17
1 files changed, 17 insertions, 0 deletions
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 023ab41810..e02ea5bd3d 100644
--- a/meta/recipes-devtools/python/python3-pip_22.0.3.bb
+++ b/meta/recipes-devtools/python/python3-pip_22.0.3.bb
@@ -24,6 +24,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() {