summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorRoss Burton <ross@burtonini.com>2022-03-07 15:26:49 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-03-08 09:42:59 +0000
commitcb56166eef34ba4937dc487664c57815daeadbe8 (patch)
treef9942fd718f2eaf1d77e049d45f060c3e2e6f263 /meta/classes
parent57c477ca13e352b6f9b21385abbfaad9778c6398 (diff)
downloadopenembedded-core-contrib-cb56166eef34ba4937dc487664c57815daeadbe8.tar.gz
pip_install_wheel: clean up
There's been a lot of work in this class lately, so a little spring cleaning is needed. Remove redundant creation of PYTHON_SITEPACKAGES_DIR, pip will do that. Remove redundant export of PYPA_WHEEL. Simplyify recompile code using "realpath --relative-to". Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/pip_install_wheel.bbclass16
1 files changed, 4 insertions, 12 deletions
diff --git a/meta/classes/pip_install_wheel.bbclass b/meta/classes/pip_install_wheel.bbclass
index 3beff685bb..c1680a24ed 100644
--- a/meta/classes/pip_install_wheel.bbclass
+++ b/meta/classes/pip_install_wheel.bbclass
@@ -20,29 +20,21 @@ PIP_INSTALL_ARGS ?= "\
--prefix=${prefix} \
"
-pip_install_wheel_do_install:prepend () {
- install -d ${D}${PYTHON_SITEPACKAGES_DIR}
-}
-
-export PYPA_WHEEL
-
PIP_INSTALL_PYTHON = "python3"
PIP_INSTALL_PYTHON:class-native = "nativepython3"
pip_install_wheel_do_install () {
nativepython3 -m pip install ${PIP_INSTALL_ARGS} ${PYPA_WHEEL} ||
- bbfatal_log "Failed to pip install wheel. Check the logs."
+ bbfatal_log "Failed to pip install wheel. Check the logs."
+ cd ${D}
for i in ${D}${bindir}/* ${D}${sbindir}/*; do
if [ -f "$i" ]; then
sed -i -e "1s,#!.*nativepython3,#!${USRBINPATH}/env ${PIP_INSTALL_PYTHON}," $i
sed -i -e "s:${PYTHON}:${USRBINPATH}/env\ ${PIP_INSTALL_PYTHON}:g" $i
sed -i -e "s:${STAGING_BINDIR_NATIVE}:${bindir}:g" $i
- # Recompile after modifying it
- cd ${D}
- file=`echo $i | sed 's:^${D}/::'`
- ${STAGING_BINDIR_NATIVE}/python3-native/python3 -c "from py_compile import compile; compile('$file')"
- cd -
+ # Not everything we find may be Python, so ignore errors
+ nativepython3 -mpy_compile $(realpath --relative-to=${D} $i) || true
fi
done
}