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:50 +0000 |
commit | 9fc8e55892374f1e63b4c995fe1a5539c42d24e0 (patch) | |
tree | d96ba360a254cd337f3c959533ad6d007823bc32 | |
parent | cd25e5544ca3f48cc4c32001e917aa3dc20dd79a (diff) | |
download | openembedded-core-contrib-9fc8e55892374f1e63b4c995fe1a5539c42d24e0.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
Signed-off-by: Tim Orling <tim.orling@konsulko.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-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 @@ DEPENDS:append = " python3-pip-native" -PIP_INSTALL_PACKAGE ?= "${PYPI_PACKAGE}" +def guess_pip_install_package_name(d): + '''https://www.python.org/dev/peps/pep-0491/#escaping-and-unicode''' + return (d.getVar('PYPI_PACKAGE') or d.getVar('PN')).replace('-', '_') + +PIP_INSTALL_PACKAGE ?= "${@guess_pip_install_package_name(d)}" PIP_INSTALL_DIST_PATH ?= "${B}/dist" PYPA_WHEEL ??= "${PIP_INSTALL_DIST_PATH}/${PIP_INSTALL_PACKAGE}-${PV}-*.whl" |