Message ID | 20220225040329.813595-2-tim.orling@konsulko.com |
---|---|
State | Accepted, archived |
Commit | 9fc8e55892374f1e63b4c995fe1a5539c42d24e0 |
Headers | show |
Series | [v2,1/2] setuptools3.bbclass: add check for pyproject.toml | expand |
On 25.02.22 05:03, Tim Orling wrote: > From: Tim Orling <ticotimo@gmail.com> > > 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> > --- > Changes in v2: > address review comments > > meta/classes/pip_install_wheel.bbclass | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/meta/classes/pip_install_wheel.bbclass b/meta/classes/pip_install_wheel.bbclass > index 8a848c0ebab..9f9feda6ee0 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('-', '_') In my opinion this needs to be BPN not PN - as if you will build python3-foo-native (for native only recipes) it will result in foo_native-1.2.3-*.whl, that just doesn't exit. What disappoints me the most is that none of this comes with unit tests - it broke for a bunch of stuff I maintain this morning, making my morning coffee taste bitter :-( > + > +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" > > > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#162335): https://lists.openembedded.org/g/openembedded-core/message/162335 > Mute This Topic: https://lists.openembedded.org/mt/89382270/3647476 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [kweihmann@outlook.com] > -=-=-=-=-=-=-=-=-=-=-=- >
On Sat, 2022-02-26 at 08:56 +0100, Konrad Weihmann wrote: > > On 25.02.22 05:03, Tim Orling wrote: > > From: Tim Orling <ticotimo@gmail.com> > > > > 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> > > --- > > Changes in v2: > > address review comments > > > > meta/classes/pip_install_wheel.bbclass | 6 +++++- > > 1 file changed, 5 insertions(+), 1 deletion(-) > > > > diff --git a/meta/classes/pip_install_wheel.bbclass b/meta/classes/pip_install_wheel.bbclass > > index 8a848c0ebab..9f9feda6ee0 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('-', '_') > > In my opinion this needs to be BPN not PN - as if you will build > python3-foo-native (for native only recipes) it will result in > foo_native-1.2.3-*.whl, that just doesn't exit. Agreed, fix sent. > What disappoints me the most is that none of this comes with unit tests > - it broke for a bunch of stuff I maintain this morning, making my > morning coffee taste bitter :-( I'd love more tests! Cheers, Richard
diff --git a/meta/classes/pip_install_wheel.bbclass b/meta/classes/pip_install_wheel.bbclass index 8a848c0ebab..9f9feda6ee0 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"