diff options
author | Konrad Weihmann <kweihmann@outlook.com> | 2022-03-02 10:18:22 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-03-02 18:43:25 +0000 |
commit | 9ead8e762e977d41b0107553b4827f9a7edc252f (patch) | |
tree | ff94d414d6c5b1440b6d21ee703cde1dac2a1769 | |
parent | 668a625ce5ff5bcd4cd5b4c29e5c0360cf51e774 (diff) | |
download | poky-9ead8e762e977d41b0107553b4827f9a7edc252f.tar.gz |
pip_install_wheel: improve wheel handling
- 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>
-rw-r--r-- | meta/classes/pip_install_wheel.bbclass | 8 | ||||
-rw-r--r-- | meta/classes/setuptools3.bbclass | 1 |
2 files changed, 6 insertions, 3 deletions
diff --git a/meta/classes/pip_install_wheel.bbclass b/meta/classes/pip_install_wheel.bbclass index 5b7e5cd706..3beff685bb 100644 --- a/meta/classes/pip_install_wheel.bbclass +++ b/meta/classes/pip_install_wheel.bbclass | |||
@@ -1,12 +1,14 @@ | |||
1 | DEPENDS:append = " python3-pip-native" | 1 | DEPENDS:append = " python3-pip-native" |
2 | 2 | ||
3 | def guess_pip_install_package_name(d): | 3 | def guess_pip_install_package_name(d): |
4 | import re | ||
4 | '''https://www.python.org/dev/peps/pep-0491/#escaping-and-unicode''' | 5 | '''https://www.python.org/dev/peps/pep-0491/#escaping-and-unicode''' |
5 | return (d.getVar('PYPI_PACKAGE') or d.getVar('BPN')).replace('-', '_') | 6 | name = d.getVar('PYPI_PACKAGE') or re.sub(r"^python3-", "", d.getVar('BPN')) |
7 | return name.replace('-', '_') | ||
6 | 8 | ||
7 | PIP_INSTALL_PACKAGE ?= "${@guess_pip_install_package_name(d)}" | 9 | PIP_INSTALL_PACKAGE ?= "${@guess_pip_install_package_name(d)}" |
8 | PIP_INSTALL_DIST_PATH ?= "${B}/dist" | 10 | PIP_INSTALL_DIST_PATH ?= "${@d.getVar('SETUPTOOLS_SETUP_PATH') or d.getVar('B')}/dist" |
9 | PYPA_WHEEL ??= "${PIP_INSTALL_DIST_PATH}/${PIP_INSTALL_PACKAGE}-${PV}-*.whl" | 11 | PYPA_WHEEL ??= "${PIP_INSTALL_DIST_PATH}/${PIP_INSTALL_PACKAGE}-*-*.whl" |
10 | 12 | ||
11 | PIP_INSTALL_ARGS ?= "\ | 13 | PIP_INSTALL_ARGS ?= "\ |
12 | -vvvv \ | 14 | -vvvv \ |
diff --git a/meta/classes/setuptools3.bbclass b/meta/classes/setuptools3.bbclass index 12561340b0..564996c556 100644 --- a/meta/classes/setuptools3.bbclass +++ b/meta/classes/setuptools3.bbclass | |||
@@ -28,6 +28,7 @@ setuptools3_do_compile() { | |||
28 | bbfatal_log "'${PYTHON_PN} setup.py bdist_wheel ${SETUPTOOLS_BUILD_ARGS}' execution failed." | 28 | bbfatal_log "'${PYTHON_PN} setup.py bdist_wheel ${SETUPTOOLS_BUILD_ARGS}' execution failed." |
29 | } | 29 | } |
30 | setuptools3_do_compile[vardepsexclude] = "MACHINE" | 30 | setuptools3_do_compile[vardepsexclude] = "MACHINE" |
31 | do_compile[cleandirs] += "${SETUPTOOLS_SETUP_PATH}/dist" | ||
31 | 32 | ||
32 | setuptools3_do_install() { | 33 | setuptools3_do_install() { |
33 | cd ${SETUPTOOLS_SETUP_PATH} | 34 | cd ${SETUPTOOLS_SETUP_PATH} |