diff options
author | Tim Orling <ticotimo@gmail.com> | 2022-02-24 20:03:31 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-02-25 15:43:53 +0000 |
commit | 49168f5d557780dfcfac997f3092923ffa747215 (patch) | |
tree | 6e169621975b28733d7e91e270dc982e69a05597 /meta/classes/pip_install_wheel.bbclass | |
parent | 4668db81755c56eba592b7f180e8882dd6835f0c (diff) | |
download | poky-49168f5d557780dfcfac997f3092923ffa747215.tar.gz |
pip_install_wheel: improved wheel filename guess
Rather than only use PYPI_PACKAGE as a guess, fall back on PN for cases
where a recipe does not inherit pypi.
Wheels can only have alphanumeric characters in the 'distribution'
name [1]. Any other characters are replaced with an underscore. Provide a
function to replace dash with underscore.
[1] https://www.python.org/dev/peps/pep-0491/#escaping-and-unicode
(From OE-Core rev: 9fc8e55892374f1e63b4c995fe1a5539c42d24e0)
Signed-off-by: Tim Orling <tim.orling@konsulko.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/pip_install_wheel.bbclass')
-rw-r--r-- | meta/classes/pip_install_wheel.bbclass | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/meta/classes/pip_install_wheel.bbclass b/meta/classes/pip_install_wheel.bbclass index 8a848c0eba..9f9feda6ee 100644 --- a/meta/classes/pip_install_wheel.bbclass +++ b/meta/classes/pip_install_wheel.bbclass | |||
@@ -1,6 +1,10 @@ | |||
1 | DEPENDS:append = " python3-pip-native" | 1 | DEPENDS:append = " python3-pip-native" |
2 | 2 | ||
3 | PIP_INSTALL_PACKAGE ?= "${PYPI_PACKAGE}" | 3 | def guess_pip_install_package_name(d): |
4 | '''https://www.python.org/dev/peps/pep-0491/#escaping-and-unicode''' | ||
5 | return (d.getVar('PYPI_PACKAGE') or d.getVar('PN')).replace('-', '_') | ||
6 | |||
7 | PIP_INSTALL_PACKAGE ?= "${@guess_pip_install_package_name(d)}" | ||
4 | PIP_INSTALL_DIST_PATH ?= "${B}/dist" | 8 | PIP_INSTALL_DIST_PATH ?= "${B}/dist" |
5 | PYPA_WHEEL ??= "${PIP_INSTALL_DIST_PATH}/${PIP_INSTALL_PACKAGE}-${PV}-*.whl" | 9 | PYPA_WHEEL ??= "${PIP_INSTALL_DIST_PATH}/${PIP_INSTALL_PACKAGE}-${PV}-*.whl" |
6 | 10 | ||