Re: [OE-core] [PATCH v3] pip_install_wheel: improve wheel handling

2022-03-02 Thread Konrad Weihmann



On 02.03.22 20:04, Khem Raj wrote:

On Wed, Mar 2, 2022 at 11:01 AM Konrad Weihmann  wrote:




On 02.03.22 19:45, Khem Raj wrote:

v4 is definitely better than v3, I see one case it could address as well e.g.

python3-pymetno produces PyMetno-0.9.0-py3-none-any.whl, so if
guessing code could address the case-sensitive piece here would be
good.


I'm torn on this one, I agree that it would really nice to have in terms
of a seamless transition, but it would require either some bash/shell
hacks to disable case sensitive filename globs or some "after compile"
renaming - I'm not sure how to tackle this.
If everyone else agrees I would vote for "after compile" renaming to a
fully lower case filename - any thoughts?



I think the suggestion that Ross has is a good one to install the wheel file
intentionally to a known location using --dist-dir and then use a more
relaxed regexp to package it.


As I mentioned in the v4 patch dist-dir doesn't work for me - somehow it 
isn't respected by most of the python modules.
So my idea would be it remain on default "dist" directory, but run 
something line rename 'y/A-Z/a-z/' ${PYPA_WHEEL} after compile - also 
minding that in PIP_INSTALL_PACKAGE.


I'm happy to see dist-dir/bdist-dir work, but so far I failed to see any 
successful run on my setup (Ubuntu 20.04 btw)






On Wed, Mar 2, 2022 at 1:21 AM Konrad Weihmann  wrote:


v4 is out.
I tried to make it work with the dist-dir/bdist-dir option, but
apparently this isn't respected by setuptools in all of the tested recipes.
That's why I went with applying cleandirs on
${SETUPTOOLS_SETUP_PATH}/dist, that should do the trick as well.

v4 is tested against all core python recipes, all the python recipes in
my layers and a reasonable subset from meta-oe

On 02.03.22 09:06, Konrad Weihmann wrote:

My bad - one of the brackets in the name guessing slipped...
Will send a v4 soon

On 02.03.22 06:20, Khem Raj wrote:

this is causing 100+ packages to fail see

https://errors.yoctoproject.org/Errors/Build/142116/

I suggest to include meta-python for wider testing of such changes.

On Tue, Mar 1, 2022 at 12:14 PM Ross Burton  wrote:


On Tue, 1 Mar 2022 at 18:48, Khem Raj  wrote:

where the wheel file is called
pytest_runner-5.3.1-py3-none-any.whl


I'm thinking we should tell pip to install the wheels to a directory
we control and then just install *.whl.

IIRC the option was --dist-dir, and we can [cleandirs] that to ensure
it's clean on builds.

Ross






-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#162623): 
https://lists.openembedded.org/g/openembedded-core/message/162623
Mute This Topic: https://lists.openembedded.org/mt/89472354/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [OE-core] [PATCH v3] pip_install_wheel: improve wheel handling

2022-03-02 Thread Khem Raj
On Wed, Mar 2, 2022 at 11:01 AM Konrad Weihmann  wrote:
>
>
>
> On 02.03.22 19:45, Khem Raj wrote:
> > v4 is definitely better than v3, I see one case it could address as well 
> > e.g.
> >
> > python3-pymetno produces PyMetno-0.9.0-py3-none-any.whl, so if
> > guessing code could address the case-sensitive piece here would be
> > good.
>
> I'm torn on this one, I agree that it would really nice to have in terms
> of a seamless transition, but it would require either some bash/shell
> hacks to disable case sensitive filename globs or some "after compile"
> renaming - I'm not sure how to tackle this.
> If everyone else agrees I would vote for "after compile" renaming to a
> fully lower case filename - any thoughts?
>

I think the suggestion that Ross has is a good one to install the wheel file
intentionally to a known location using --dist-dir and then use a more
relaxed regexp to package it.

> >
> > On Wed, Mar 2, 2022 at 1:21 AM Konrad Weihmann  
> > wrote:
> >>
> >> v4 is out.
> >> I tried to make it work with the dist-dir/bdist-dir option, but
> >> apparently this isn't respected by setuptools in all of the tested recipes.
> >> That's why I went with applying cleandirs on
> >> ${SETUPTOOLS_SETUP_PATH}/dist, that should do the trick as well.
> >>
> >> v4 is tested against all core python recipes, all the python recipes in
> >> my layers and a reasonable subset from meta-oe
> >>
> >> On 02.03.22 09:06, Konrad Weihmann wrote:
> >>> My bad - one of the brackets in the name guessing slipped...
> >>> Will send a v4 soon
> >>>
> >>> On 02.03.22 06:20, Khem Raj wrote:
>  this is causing 100+ packages to fail see
> 
>  https://errors.yoctoproject.org/Errors/Build/142116/
> 
>  I suggest to include meta-python for wider testing of such changes.
> 
>  On Tue, Mar 1, 2022 at 12:14 PM Ross Burton  wrote:
> >
> > On Tue, 1 Mar 2022 at 18:48, Khem Raj  wrote:
> >> where the wheel file is called
> >> pytest_runner-5.3.1-py3-none-any.whl
> >
> > I'm thinking we should tell pip to install the wheels to a directory
> > we control and then just install *.whl.
> >
> > IIRC the option was --dist-dir, and we can [cleandirs] that to ensure
> > it's clean on builds.
> >
> > Ross
> >>>
> >>>
> >>> 
> >>>

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#162621): 
https://lists.openembedded.org/g/openembedded-core/message/162621
Mute This Topic: https://lists.openembedded.org/mt/89472354/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [OE-core] [PATCH v3] pip_install_wheel: improve wheel handling

2022-03-02 Thread Konrad Weihmann



On 02.03.22 19:45, Khem Raj wrote:

v4 is definitely better than v3, I see one case it could address as well e.g.

python3-pymetno produces PyMetno-0.9.0-py3-none-any.whl, so if
guessing code could address the case-sensitive piece here would be
good.


I'm torn on this one, I agree that it would really nice to have in terms 
of a seamless transition, but it would require either some bash/shell 
hacks to disable case sensitive filename globs or some "after compile" 
renaming - I'm not sure how to tackle this.
If everyone else agrees I would vote for "after compile" renaming to a 
fully lower case filename - any thoughts?




On Wed, Mar 2, 2022 at 1:21 AM Konrad Weihmann  wrote:


v4 is out.
I tried to make it work with the dist-dir/bdist-dir option, but
apparently this isn't respected by setuptools in all of the tested recipes.
That's why I went with applying cleandirs on
${SETUPTOOLS_SETUP_PATH}/dist, that should do the trick as well.

v4 is tested against all core python recipes, all the python recipes in
my layers and a reasonable subset from meta-oe

On 02.03.22 09:06, Konrad Weihmann wrote:

My bad - one of the brackets in the name guessing slipped...
Will send a v4 soon

On 02.03.22 06:20, Khem Raj wrote:

this is causing 100+ packages to fail see

https://errors.yoctoproject.org/Errors/Build/142116/

I suggest to include meta-python for wider testing of such changes.

On Tue, Mar 1, 2022 at 12:14 PM Ross Burton  wrote:


On Tue, 1 Mar 2022 at 18:48, Khem Raj  wrote:

where the wheel file is called
pytest_runner-5.3.1-py3-none-any.whl


I'm thinking we should tell pip to install the wheels to a directory
we control and then just install *.whl.

IIRC the option was --dist-dir, and we can [cleandirs] that to ensure
it's clean on builds.

Ross






-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#162620): 
https://lists.openembedded.org/g/openembedded-core/message/162620
Mute This Topic: https://lists.openembedded.org/mt/89472354/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [OE-core] [PATCH v3] pip_install_wheel: improve wheel handling

2022-03-02 Thread Khem Raj
v4 is definitely better than v3, I see one case it could address as well e.g.

python3-pymetno produces PyMetno-0.9.0-py3-none-any.whl, so if
guessing code could address the case-sensitive piece here would be
good.

On Wed, Mar 2, 2022 at 1:21 AM Konrad Weihmann  wrote:
>
> v4 is out.
> I tried to make it work with the dist-dir/bdist-dir option, but
> apparently this isn't respected by setuptools in all of the tested recipes.
> That's why I went with applying cleandirs on
> ${SETUPTOOLS_SETUP_PATH}/dist, that should do the trick as well.
>
> v4 is tested against all core python recipes, all the python recipes in
> my layers and a reasonable subset from meta-oe
>
> On 02.03.22 09:06, Konrad Weihmann wrote:
> > My bad - one of the brackets in the name guessing slipped...
> > Will send a v4 soon
> >
> > On 02.03.22 06:20, Khem Raj wrote:
> >> this is causing 100+ packages to fail see
> >>
> >> https://errors.yoctoproject.org/Errors/Build/142116/
> >>
> >> I suggest to include meta-python for wider testing of such changes.
> >>
> >> On Tue, Mar 1, 2022 at 12:14 PM Ross Burton  wrote:
> >>>
> >>> On Tue, 1 Mar 2022 at 18:48, Khem Raj  wrote:
>  where the wheel file is called
>  pytest_runner-5.3.1-py3-none-any.whl
> >>>
> >>> I'm thinking we should tell pip to install the wheels to a directory
> >>> we control and then just install *.whl.
> >>>
> >>> IIRC the option was --dist-dir, and we can [cleandirs] that to ensure
> >>> it's clean on builds.
> >>>
> >>> Ross
> >
> >
> > 
> >

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#162619): 
https://lists.openembedded.org/g/openembedded-core/message/162619
Mute This Topic: https://lists.openembedded.org/mt/89472354/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [OE-core] [PATCH v3] pip_install_wheel: improve wheel handling

2022-03-02 Thread Konrad Weihmann

v4 is out.
I tried to make it work with the dist-dir/bdist-dir option, but 
apparently this isn't respected by setuptools in all of the tested recipes.
That's why I went with applying cleandirs on 
${SETUPTOOLS_SETUP_PATH}/dist, that should do the trick as well.


v4 is tested against all core python recipes, all the python recipes in 
my layers and a reasonable subset from meta-oe


On 02.03.22 09:06, Konrad Weihmann wrote:

My bad - one of the brackets in the name guessing slipped...
Will send a v4 soon

On 02.03.22 06:20, Khem Raj wrote:

this is causing 100+ packages to fail see

https://errors.yoctoproject.org/Errors/Build/142116/

I suggest to include meta-python for wider testing of such changes.

On Tue, Mar 1, 2022 at 12:14 PM Ross Burton  wrote:


On Tue, 1 Mar 2022 at 18:48, Khem Raj  wrote:

where the wheel file is called
pytest_runner-5.3.1-py3-none-any.whl


I'm thinking we should tell pip to install the wheels to a directory
we control and then just install *.whl.

IIRC the option was --dist-dir, and we can [cleandirs] that to ensure
it's clean on builds.

Ross






-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#162601): 
https://lists.openembedded.org/g/openembedded-core/message/162601
Mute This Topic: https://lists.openembedded.org/mt/89472354/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [OE-core] [PATCH v3] pip_install_wheel: improve wheel handling

2022-03-02 Thread Konrad Weihmann

My bad - one of the brackets in the name guessing slipped...
Will send a v4 soon

On 02.03.22 06:20, Khem Raj wrote:

this is causing 100+ packages to fail see

https://errors.yoctoproject.org/Errors/Build/142116/

I suggest to include meta-python for wider testing of such changes.

On Tue, Mar 1, 2022 at 12:14 PM Ross Burton  wrote:


On Tue, 1 Mar 2022 at 18:48, Khem Raj  wrote:

where the wheel file is called
pytest_runner-5.3.1-py3-none-any.whl


I'm thinking we should tell pip to install the wheels to a directory
we control and then just install *.whl.

IIRC the option was --dist-dir, and we can [cleandirs] that to ensure
it's clean on builds.

Ross

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#162595): 
https://lists.openembedded.org/g/openembedded-core/message/162595
Mute This Topic: https://lists.openembedded.org/mt/89472354/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [OE-core] [PATCH v3] pip_install_wheel: improve wheel handling

2022-03-01 Thread Khem Raj
this is causing 100+ packages to fail see

https://errors.yoctoproject.org/Errors/Build/142116/

I suggest to include meta-python for wider testing of such changes.

On Tue, Mar 1, 2022 at 12:14 PM Ross Burton  wrote:
>
> On Tue, 1 Mar 2022 at 18:48, Khem Raj  wrote:
> > where the wheel file is called
> > pytest_runner-5.3.1-py3-none-any.whl
>
> I'm thinking we should tell pip to install the wheels to a directory
> we control and then just install *.whl.
>
> IIRC the option was --dist-dir, and we can [cleandirs] that to ensure
> it's clean on builds.
>
> Ross

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#162589): 
https://lists.openembedded.org/g/openembedded-core/message/162589
Mute This Topic: https://lists.openembedded.org/mt/89472354/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [OE-core] [PATCH v3] pip_install_wheel: improve wheel handling

2022-03-01 Thread Ross Burton
On Tue, 1 Mar 2022 at 18:48, Khem Raj  wrote:
> where the wheel file is called
> pytest_runner-5.3.1-py3-none-any.whl

I'm thinking we should tell pip to install the wheels to a directory
we control and then just install *.whl.

IIRC the option was --dist-dir, and we can [cleandirs] that to ensure
it's clean on builds.

Ross

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#162572): 
https://lists.openembedded.org/g/openembedded-core/message/162572
Mute This Topic: https://lists.openembedded.org/mt/89472354/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [OE-core] [PATCH v3] pip_install_wheel: improve wheel handling

2022-03-01 Thread Khem Raj
I am seeing this

| Created temporary directory: /tmp/pip-install-33iiigxv
| WARNING: Requirement
'/mnt/b/yoe/master/build/tmp/work/x86_64-linux/python3-pytest-runner-native/5.3.1-r0/pytest-runner-5.3.1/dist/pytest-runner-*-*.whl'
looks like a filename, but the file does not exist
| ERROR: pytest-runner-*-*.whl is not a valid wheel filename.
| Exception information:
| Traceback (most recent call last):
|   File 
"/mnt/b/yoe/master/build/tmp/work/x86_64-linux/python3-pytest-runner-native/5.3.1-r0/recipe-sysroot-native/usr/lib/python3.10/site-packages/pip/_internal/cli/base_command.py",
line 167, in exc_logging_wrapper

where the wheel file is called
pytest_runner-5.3.1-py3-none-any.whl

On Tue, Mar 1, 2022 at 7:22 AM Tim Orling  wrote:
>
>
>
> On Tue, Mar 1, 2022 at 1:42 AM Konrad Weihmann  wrote:
>>
>> - 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
>> - 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
>>
> Thank you. These are patterns that were never seen during development, but 
> are painfully obvious now.
> The wheel spec (PEP-427) allows for, for instance, dev/pre-release wheels 
> which we see with the
> python3-dtc recipe from meta-virtualization.
>
>>
>> Signed-off-by: Konrad Weihmann 
>
> Reviewed-by: Tim Orling 
>>
>>
>>
>> ---
>> v3: remove in prepend to compile, not in install for obvious reasons
>> v2: fix python3 prefix string
>>
>>  meta/classes/pip_install_wheel.bbclass | 12 +---
>>  1 file changed, 9 insertions(+), 3 deletions(-)
>>
>> diff --git a/meta/classes/pip_install_wheel.bbclass 
>> b/meta/classes/pip_install_wheel.bbclass
>> index 5b7e5cd706..789c25b68c 100644
>> --- a/meta/classes/pip_install_wheel.bbclass
>> +++ b/meta/classes/pip_install_wheel.bbclass
>> @@ -1,12 +1,13 @@
>>  DEPENDS:append = " python3-pip-native"
>>
>>  def guess_pip_install_package_name(d):
>> +import re
>>  '''https://www.python.org/dev/peps/pep-0491/#escaping-and-unicode'''
>> -return (d.getVar('PYPI_PACKAGE') or d.getVar('BPN')).replace('-', '_')
>> +return (d.getVar('PYPI_PACKAGE') or re.sub(r"^python3-", "", 
>> d.getVar('BPN')).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"
>> +PIP_INSTALL_DIST_PATH ?= "${@d.getVar('SETUPTOOLS_SETUP_PATH') or 
>> d.getVar('B')}/dist"
>> +PYPA_WHEEL ??= "${PIP_INSTALL_DIST_PATH}/${PIP_INSTALL_PACKAGE}-*-*.whl"
>>
>>  PIP_INSTALL_ARGS ?= "\
>>  - \
>> @@ -45,4 +46,9 @@ pip_install_wheel_do_install () {
>>  done
>>  }
>>
>> +do_compile:prepend() {
>> +# cleanup previously generated files
>> +rm -f ${PYPA_WHEEL}
>> +}
>> +
>>  EXPORT_FUNCTIONS do_install
>> --
>> 2.25.1
>>
>>
>>
>>
>
> 
>

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#162569): 
https://lists.openembedded.org/g/openembedded-core/message/162569
Mute This Topic: https://lists.openembedded.org/mt/89472354/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [OE-core] [PATCH v3] pip_install_wheel: improve wheel handling

2022-03-01 Thread Tim Orling
On Tue, Mar 1, 2022 at 1:42 AM Konrad Weihmann 
wrote:

> - 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
> - 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
>
> Thank you. These are patterns that were never seen during development, but
are painfully obvious now.
The wheel spec (PEP-427) allows for, for instance, dev/pre-release wheels
which we see with the
python3-dtc recipe from meta-virtualization.


> Signed-off-by: Konrad Weihmann 

Reviewed-by: Tim Orling 

>

---
> v3: remove in prepend to compile, not in install for obvious reasons
> v2: fix python3 prefix string
>
>  meta/classes/pip_install_wheel.bbclass | 12 +---
>  1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/meta/classes/pip_install_wheel.bbclass
> b/meta/classes/pip_install_wheel.bbclass
> index 5b7e5cd706..789c25b68c 100644
> --- a/meta/classes/pip_install_wheel.bbclass
> +++ b/meta/classes/pip_install_wheel.bbclass
> @@ -1,12 +1,13 @@
>  DEPENDS:append = " python3-pip-native"
>
>  def guess_pip_install_package_name(d):
> +import re
>  '''https://www.python.org/dev/peps/pep-0491/#escaping-and-unicode'''
> -return (d.getVar('PYPI_PACKAGE') or d.getVar('BPN')).replace('-', '_')
> +return (d.getVar('PYPI_PACKAGE') or re.sub(r"^python3-", "",
> d.getVar('BPN')).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"
> +PIP_INSTALL_DIST_PATH ?= "${@d.getVar('SETUPTOOLS_SETUP_PATH') or
> d.getVar('B')}/dist"
> +PYPA_WHEEL ??= "${PIP_INSTALL_DIST_PATH}/${PIP_INSTALL_PACKAGE}-*-*.whl"
>
>  PIP_INSTALL_ARGS ?= "\
>  - \
> @@ -45,4 +46,9 @@ pip_install_wheel_do_install () {
>  done
>  }
>
> +do_compile:prepend() {
> +# cleanup previously generated files
> +rm -f ${PYPA_WHEEL}
> +}
> +
>  EXPORT_FUNCTIONS do_install
> --
> 2.25.1
>
>
> 
>
>

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#162559): 
https://lists.openembedded.org/g/openembedded-core/message/162559
Mute This Topic: https://lists.openembedded.org/mt/89472354/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[OE-core] [PATCH v3] pip_install_wheel: improve wheel handling

2022-03-01 Thread Konrad Weihmann
- 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
- 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

Signed-off-by: Konrad Weihmann 
---
v3: remove in prepend to compile, not in install for obvious reasons
v2: fix python3 prefix string

 meta/classes/pip_install_wheel.bbclass | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/meta/classes/pip_install_wheel.bbclass 
b/meta/classes/pip_install_wheel.bbclass
index 5b7e5cd706..789c25b68c 100644
--- a/meta/classes/pip_install_wheel.bbclass
+++ b/meta/classes/pip_install_wheel.bbclass
@@ -1,12 +1,13 @@
 DEPENDS:append = " python3-pip-native"
 
 def guess_pip_install_package_name(d):
+import re
 '''https://www.python.org/dev/peps/pep-0491/#escaping-and-unicode'''
-return (d.getVar('PYPI_PACKAGE') or d.getVar('BPN')).replace('-', '_')
+return (d.getVar('PYPI_PACKAGE') or re.sub(r"^python3-", "", 
d.getVar('BPN')).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"
+PIP_INSTALL_DIST_PATH ?= "${@d.getVar('SETUPTOOLS_SETUP_PATH') or 
d.getVar('B')}/dist"
+PYPA_WHEEL ??= "${PIP_INSTALL_DIST_PATH}/${PIP_INSTALL_PACKAGE}-*-*.whl"
 
 PIP_INSTALL_ARGS ?= "\
 - \
@@ -45,4 +46,9 @@ pip_install_wheel_do_install () {
 done
 }
 
+do_compile:prepend() {
+# cleanup previously generated files
+rm -f ${PYPA_WHEEL}
+}
+
 EXPORT_FUNCTIONS do_install
-- 
2.25.1


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#162541): 
https://lists.openembedded.org/g/openembedded-core/message/162541
Mute This Topic: https://lists.openembedded.org/mt/89472354/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-