mirror of
https://git.yoctoproject.org/poky
synced 2026-03-05 14:59:41 +01:00
- replace python3 prefix when guessing the wheel name as there are still plenty of recipes out there that do use python3 prefixes - remove all previously generated wheels matching the glob to avoid installing any outdated blob via cleandirs in setuptools3 class. Unfortunetaly proposed dist-dir or bdist-dir are not respected by setuptools, likely due because they are overridable by the setup script - don't use PV in glob, as PV doesn't necessarily align with the version used inside of the setuptools configuration. this will avoid having the user set PYPA_WHEEL in a lot of recipes - respect SETUPTOOLS_SETUP_PATH in PIP_INSTALL_DIST_PATH and use B as a fallback only (in case this class is inherited without setuptools3 class being there as well). recipes like python3-smbus run in a subfolder of the workspace and were failing in before this adjustment (From OE-Core rev: 6f2d85a7b7d94101f2ce67115166fa86c185650f) Signed-off-by: Konrad Weihmann <kweihmann@outlook.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
51 lines
1.6 KiB
Plaintext
51 lines
1.6 KiB
Plaintext
DEPENDS:append = " python3-pip-native"
|
|
|
|
def guess_pip_install_package_name(d):
|
|
import re
|
|
'''https://www.python.org/dev/peps/pep-0491/#escaping-and-unicode'''
|
|
name = d.getVar('PYPI_PACKAGE') or re.sub(r"^python3-", "", d.getVar('BPN'))
|
|
return name.replace('-', '_')
|
|
|
|
PIP_INSTALL_PACKAGE ?= "${@guess_pip_install_package_name(d)}"
|
|
PIP_INSTALL_DIST_PATH ?= "${@d.getVar('SETUPTOOLS_SETUP_PATH') or d.getVar('B')}/dist"
|
|
PYPA_WHEEL ??= "${PIP_INSTALL_DIST_PATH}/${PIP_INSTALL_PACKAGE}-*-*.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
|