pip_install_wheel: Use BPN instead of PN to construct PYPI_PACKAGE default

Message ID 20220226082142.119063-1-richard.purdie@linuxfoundation.org
State Accepted, archived
Commit 498342f483118d22f529c4e255cc50455d51e9ed
Headers show
Series pip_install_wheel: Use BPN instead of PN to construct PYPI_PACKAGE default | expand

Commit Message

Richard Purdie Feb. 26, 2022, 8:21 a.m. UTC
This fixes the name for native and nativesdk recipes.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 meta/classes/pip_install_wheel.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Tim Orling Feb. 26, 2022, 6:32 p.m. UTC | #1
Thank you.

On Sat, Feb 26, 2022 at 12:21 AM Richard Purdie <
richard.purdie@linuxfoundation.org> wrote:

> This fixes the name for native and nativesdk recipes.
>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
>  meta/classes/pip_install_wheel.bbclass | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meta/classes/pip_install_wheel.bbclass
> b/meta/classes/pip_install_wheel.bbclass
> index 9f9feda6ee0..5b7e5cd7064 100644
> --- a/meta/classes/pip_install_wheel.bbclass
> +++ b/meta/classes/pip_install_wheel.bbclass
> @@ -2,7 +2,7 @@ DEPENDS:append = " python3-pip-native"
>
>  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('-', '_')
> +    return (d.getVar('PYPI_PACKAGE') or d.getVar('BPN')).replace('-', '_')
>
>  PIP_INSTALL_PACKAGE ?= "${@guess_pip_install_package_name(d)}"
>  PIP_INSTALL_DIST_PATH ?= "${B}/dist"
> --
> 2.32.0
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#162423):
> https://lists.openembedded.org/g/openembedded-core/message/162423
> Mute This Topic: https://lists.openembedded.org/mt/89406689/924729
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> ticotimo@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
Konrad Weihmann Feb. 27, 2022, 10:29 a.m. UTC | #2
Some more observations when using the current state of the pip/wheels 
patch series (from today's master)

- when using recipes that inherit setuptools (but not pypi) and do have 
a "python3-..." prefix in the recipe name - the name guessing fails. IMO 
it would be best to strip the "python3-" prefix in the guessing too

- when using recipes that do not have a version matching *exactly* the 
one from setup.py|pyproject.toml the wheel glob `PYPA_WHEEL ??= 
"${PIP_INSTALL_DIST_PATH}/${PIP_INSTALL_PACKAGE}-${PV}-*.whl"` fails
  - examples:
	- PV = "1.2.3+${SRCREV}" for recipes that have additional patches on it
	- recipe name is python3-foo_git.bb

In my opinion it doesn't make sense to have ${PV} in that glob - a 
simple asterisk would match all of them easily - or this there any real 
life example where a single python project builds several packages with 
different versions in the same workspace?

- another thing is SETUPTOOLS_INSTALL_ARGS ?= "--root=${D} 
--prefix=${prefix}" breaks a recipe that was previously installing files 
to "/etc" aka ${sysconfdir} - these are now installed into /usr/etc, 
which doesn't look right. For reference the project is 
https://github.com/HewlettPackard/reconbf

In a sense of a more painless transition these issues should be 
addressed before any release

On 26.02.22 09:21, Richard Purdie wrote:
> This fixes the name for native and nativesdk recipes.
> 
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
>   meta/classes/pip_install_wheel.bbclass | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/meta/classes/pip_install_wheel.bbclass b/meta/classes/pip_install_wheel.bbclass
> index 9f9feda6ee0..5b7e5cd7064 100644
> --- a/meta/classes/pip_install_wheel.bbclass
> +++ b/meta/classes/pip_install_wheel.bbclass
> @@ -2,7 +2,7 @@ DEPENDS:append = " python3-pip-native"
>   
>   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('-', '_')
> +    return (d.getVar('PYPI_PACKAGE') or d.getVar('BPN')).replace('-', '_')
>   
>   PIP_INSTALL_PACKAGE ?= "${@guess_pip_install_package_name(d)}"
>   PIP_INSTALL_DIST_PATH ?= "${B}/dist"
> 
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#162423): https://lists.openembedded.org/g/openembedded-core/message/162423
> Mute This Topic: https://lists.openembedded.org/mt/89406689/3647476
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [kweihmann@outlook.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Khem Raj Feb. 28, 2022, 2:49 a.m. UTC | #3
On Sun, Feb 27, 2022 at 2:30 AM Konrad Weihmann <kweihmann@outlook.com>
wrote:

> Some more observations when using the current state of the pip/wheels
> patch series (from today's master)
>
> - when using recipes that inherit setuptools (but not pypi) and do have
> a "python3-..." prefix in the recipe name - the name guessing fails. IMO
> it would be best to strip the "python3-" prefix in the guessing too
>
> - when using recipes that do not have a version matching *exactly* the
> one from setup.py|pyproject.toml the wheel glob `PYPA_WHEEL ??=
> "${PIP_INSTALL_DIST_PATH}/${PIP_INSTALL_PACKAGE}-${PV}-*.whl"` fails
>   - examples:
>         - PV = "1.2.3+${SRCREV}" for recipes that have additional patches
> on it
>         - recipe name is python3-foo_git.bb
>
> In my opinion it doesn't make sense to have ${PV} in that glob - a
> simple asterisk would match all of them easily - or this there any real
> life example where a single python project builds several packages with
> different versions in the same workspace?


Right this would avoid overwriting this in many recipes agreed


>
> - another thing is SETUPTOOLS_INSTALL_ARGS ?= "--root=${D}
> --prefix=${prefix}" breaks a recipe that was previously installing files
> to "/etc" aka ${sysconfdir} - these are now installed into /usr/etc,
> which doesn't look right. For reference the project is
> https://github.com/HewlettPackard/reconbf
>
> In a sense of a more painless transition these issues should be
> addressed before any release
>
> On 26.02.22 09:21, Richard Purdie wrote:
> > This fixes the name for native and nativesdk recipes.
> >
> > Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> > ---
> >   meta/classes/pip_install_wheel.bbclass | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/meta/classes/pip_install_wheel.bbclass
> b/meta/classes/pip_install_wheel.bbclass
> > index 9f9feda6ee0..5b7e5cd7064 100644
> > --- a/meta/classes/pip_install_wheel.bbclass
> > +++ b/meta/classes/pip_install_wheel.bbclass
> > @@ -2,7 +2,7 @@ DEPENDS:append = " python3-pip-native"
> >
> >   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('-',
> '_')
> > +    return (d.getVar('PYPI_PACKAGE') or d.getVar('BPN')).replace('-',
> '_')
> >
> >   PIP_INSTALL_PACKAGE ?= "${@guess_pip_install_package_name(d)}"
> >   PIP_INSTALL_DIST_PATH ?= "${B}/dist"
> >
> >
> >
> >
> >
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#162432):
> https://lists.openembedded.org/g/openembedded-core/message/162432
> Mute This Topic: https://lists.openembedded.org/mt/89406689/1997914
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>

Patch

diff --git a/meta/classes/pip_install_wheel.bbclass b/meta/classes/pip_install_wheel.bbclass
index 9f9feda6ee0..5b7e5cd7064 100644
--- a/meta/classes/pip_install_wheel.bbclass
+++ b/meta/classes/pip_install_wheel.bbclass
@@ -2,7 +2,7 @@  DEPENDS:append = " python3-pip-native"
 
 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('-', '_')
+    return (d.getVar('PYPI_PACKAGE') or d.getVar('BPN')).replace('-', '_')
 
 PIP_INSTALL_PACKAGE ?= "${@guess_pip_install_package_name(d)}"
 PIP_INSTALL_DIST_PATH ?= "${B}/dist"