diff options
author | Ross Burton <ross@burtonini.com> | 2022-03-07 15:26:49 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-03-08 09:44:27 +0000 |
commit | c38a95d4f59ee68cdb4929ac50ef311085846995 (patch) | |
tree | 60a21e7ced236dfc5ea98615e731d2d5235f2a95 /meta/classes | |
parent | 2552f836c90b8b7355da37415920107c26fb35c0 (diff) | |
download | poky-c38a95d4f59ee68cdb4929ac50ef311085846995.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".
(From OE-Core rev: cb56166eef34ba4937dc487664c57815daeadbe8)
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.bbclass | 16 |
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 ?= "\ | |||
20 | --prefix=${prefix} \ | 20 | --prefix=${prefix} \ |
21 | " | 21 | " |
22 | 22 | ||
23 | pip_install_wheel_do_install:prepend () { | ||
24 | install -d ${D}${PYTHON_SITEPACKAGES_DIR} | ||
25 | } | ||
26 | |||
27 | export PYPA_WHEEL | ||
28 | |||
29 | PIP_INSTALL_PYTHON = "python3" | 23 | PIP_INSTALL_PYTHON = "python3" |
30 | PIP_INSTALL_PYTHON:class-native = "nativepython3" | 24 | PIP_INSTALL_PYTHON:class-native = "nativepython3" |
31 | 25 | ||
32 | pip_install_wheel_do_install () { | 26 | pip_install_wheel_do_install () { |
33 | nativepython3 -m pip install ${PIP_INSTALL_ARGS} ${PYPA_WHEEL} || | 27 | nativepython3 -m pip install ${PIP_INSTALL_ARGS} ${PYPA_WHEEL} || |
34 | bbfatal_log "Failed to pip install wheel. Check the logs." | 28 | bbfatal_log "Failed to pip install wheel. Check the logs." |
35 | 29 | ||
30 | cd ${D} | ||
36 | for i in ${D}${bindir}/* ${D}${sbindir}/*; do | 31 | for i in ${D}${bindir}/* ${D}${sbindir}/*; do |
37 | if [ -f "$i" ]; then | 32 | if [ -f "$i" ]; then |
38 | sed -i -e "1s,#!.*nativepython3,#!${USRBINPATH}/env ${PIP_INSTALL_PYTHON}," $i | 33 | sed -i -e "1s,#!.*nativepython3,#!${USRBINPATH}/env ${PIP_INSTALL_PYTHON}," $i |
39 | sed -i -e "s:${PYTHON}:${USRBINPATH}/env\ ${PIP_INSTALL_PYTHON}:g" $i | 34 | sed -i -e "s:${PYTHON}:${USRBINPATH}/env\ ${PIP_INSTALL_PYTHON}:g" $i |
40 | sed -i -e "s:${STAGING_BINDIR_NATIVE}:${bindir}:g" $i | 35 | sed -i -e "s:${STAGING_BINDIR_NATIVE}:${bindir}:g" $i |
41 | # Recompile after modifying it | 36 | # Not everything we find may be Python, so ignore errors |
42 | cd ${D} | 37 | nativepython3 -mpy_compile $(realpath --relative-to=${D} $i) || true |
43 | file=`echo $i | sed 's:^${D}/::'` | ||
44 | ${STAGING_BINDIR_NATIVE}/python3-native/python3 -c "from py_compile import compile; compile('$file')" | ||
45 | cd - | ||
46 | fi | 38 | fi |
47 | done | 39 | done |
48 | } | 40 | } |