Files
poky/meta/classes/pip_install_wheel.bbclass
Richard Purdie 3dbb469523 pip_install_wheel: Use --ignore-installed for pip
Replace the use of --force-reinstall with --ignore-installed when running pip
install. It can detect currently installed modules in the wrong environment and
try to remove them currently which is not what is desired. Ignoring them is the
correct thing to do.

(From OE-Core rev: 39b0d36b00d98a848297d0667c6cffc049d215e3)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-02-25 15:07:50 +00:00

45 lines
1.3 KiB
Plaintext

DEPENDS:append = " python3-pip-native"
PIP_INSTALL_PACKAGE ?= "${PYPI_PACKAGE}"
PIP_INSTALL_DIST_PATH ?= "${B}/dist"
PYPA_WHEEL ??= "${PIP_INSTALL_DIST_PATH}/${PIP_INSTALL_PACKAGE}-${PV}-*.whl"
PIP_INSTALL_ARGS ?= "\
-vvvv \
--ignore-installed \
--no-cache \
--no-deps \
--no-index \
--root=${D} \
--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."
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 -
fi
done
}
EXPORT_FUNCTIONS do_install