Skip to contentSkip to conversation

pip_install_wheel: don't lazy assign PIPINSTALLARGS

PATCH In review Ross Burton 3 participants 8 messages Mar 7, 2022 – Mar 8, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 pip_install_wheel: don't lazy assign PIPINSTALLARGS

If we expect users to extend this we should use =, as otherwise a recipe that does += will replace the default value.

---
 meta/classes/pip_install_wheel.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/pip_install_wheel.bbclass +1 -1
index c1680a24ed..febcc8e445 100644
@@ -10,7 +10,7 @@ PIP_INSTALL_PACKAGE ?= "${@guess_pip_install_package_name(d)}"
 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 ?= "\
+PIP_INSTALL_ARGS = "\
     -vvvv \
     --ignore-installed \
     --no-cache \
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/4 python3-pip: remove obsolete and confusing comment

This comment is very obsolete.

---
 meta/recipes-devtools/python/python3-pip_22.0.3.bb | 1 -
 1 file changed, 1 deletion(-)
meta/recipes-devtools/python/python3-pip_22.0.3.bb +0 -1
index 7eb9fb69ba..8d6dfcede7 100644
@@ -45,7 +45,6 @@ EOF
 }
 
 do_install:append() {
-    # Install as pip3 and leave pip2 as default
     if [ -e ${D}/${bindir}/pip ]; then
         rm ${D}/${bindir}/pip
     fi
Signature · 1 line
2.25.1
#2 lore raw

PATCH 3/4 flit_core: clean up configure/compile

In reply to Ross Burton

Make do_configure do nothing by default as the base configure isn't useful, and invoke the build API directly instead of writing a script.

In the future, this can simply call python3-build.

---
 meta/classes/flit_core.bbclass | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
meta/classes/flit_core.bbclass +4 -6
index 819d12457c..a7667795fe 100644
@@ -3,15 +3,13 @@ inherit pip_install_wheel python3native python3-dir setuptools3-base
 DEPENDS += "python3 python3-flit-core-native python3-pip-native"
 
 flit_core_do_configure () {
-    mkdir -p ${S}/dist
-    cat > ${S}/build-it.py << EOF
-from flit_core import buildapi
-buildapi.build_wheel('./dist')
-EOF
+    :
 }
 
+# TODO: ideally this uses pypa/build
 flit_core_do_compile () {
-    ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} ${S}/build-it.py
+    mkdir -p ${S}/dist
+    nativepython3 -c "from flit_core import buildapi; buildapi.build_wheel('./dist')"
 }
 
 EXPORT_FUNCTIONS do_configure do_compile
Signature · 1 line
2.25.1
#3 lore raw

PATCH 4/4 setuptools_build_meta: clean up configure/compile

In reply to Ross Burton

Make do_configure do nothing by default as the base configure isn't useful, and invoke the build API directly instead of writing a script.

In the future, this can simply call python3-build.

---
 meta/classes/setuptools_build_meta.bbclass | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
meta/classes/setuptools_build_meta.bbclass +4 -7
index 8f5479e922..0651cca0a0 100644
@@ -3,16 +3,13 @@ inherit pip_install_wheel setuptools3-base
 DEPENDS += "python3-setuptools-native python3-wheel-native"
 
 setuptools_build_meta_do_configure () {
-    mkdir -p ${S}/dist
-    cat > ${S}/build-it.py << EOF
-from setuptools import build_meta
-wheel = build_meta.build_wheel('./dist')
-print(wheel)
-EOF
+    :
 }
 
+# TODO: ideally this uses pypa/build
 setuptools_build_meta_do_compile () {
-    nativepython3 ${S}/build-it.py
+    mkdir -p ${S}/dist
+    nativepython3 -c "from setuptools import build_meta; build_meta.build_wheel('./dist')"
 }
 
 EXPORT_FUNCTIONS do_configure do_compile
Signature · 1 line
2.25.1
#4 lore raw
In reply to Ross Burton
Quoted 15 lines · Ross Burton

If we expect users to extend this we should use =, as otherwise a recipe that does += will replace the default value.

---
  meta/classes/pip_install_wheel.bbclass | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/pip_install_wheel.bbclass +0 -0
index c1680a24ed..febcc8e445 100644

meta/classes/pip_install_wheel.bbclass PIP_INSTALL_PACKAGE ?= "${@guess_pip_install_package_name(d)}" · line 16

Quoted 8 lines
meta/classes/pip_install_wheel.bbclass +1 -1
@@ -10,7 +10,7 @@ PIP_INSTALL_PACKAGE ?= "${@guess_pip_install_package_name(d)}"
  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 ?= "\
+PIP_INSTALL_ARGS = "\
      -vvvv \
      --ignore-installed \
      --no-cache \

Hmm all of the classes use ?= and I think for a reason - this isn't the fault of the bbclass but of the recipe in the end, as += is known to cause this depending on where the additions have been added (before the inherit or after it) - I think the better way would be to use PIP_INSTALL_ARGS:append in the actual recipe - guess the fallout would be way less than the one I expect from this change.

The big question is if that should changeable by the user or not - I personally think it should be

Quoted 9 lines

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#162860): https://lists.openembedded.org/g/openembedded-core/message/162860
Mute This Topic: https://lists.openembedded.org/mt/89621292/3647476
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#5 lore raw

Personally I can’t see any reason to extend the pip install arguments. What option do you think would be used by a recipe?

Ross

Quoted 52 lines · Konrad Weihmann

Review

Quoted 9 lines · Ross Burton

If we expect users to extend this we should use =, as otherwise a recipe that does += will replace the default value.

---
  meta/classes/pip_install_wheel.bbclass | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/meta/classes/pip_install_wheel.bbclass

meta/classes/pip_install_wheel.bbclass PIP_INSTALL_PACKAGE ?=

Quoted 4 lines

index c1680a24ed..febcc8e445 100644

meta/classes/pip_install_wheel.bbclass +0 -0
@@ -10,7 +10,7 @@ PIP_INSTALL_PACKAGE ?=

"${@guess_pip_install_package_name(d)}"

meta/classes/pip_install_wheel.bbclass PIP_INSTALL_PACKAGE ?= · line 10

Quoted 1 line
meta/classes/pip_install_wheel.bbclass +0 -0
  PIP_INSTALL_DIST_PATH ?= "${@d.getVar('SETUPTOOLS_SETUP_PATH') or

d.getVar('B')}/dist"

meta/classes/pip_install_wheel.bbclass PIP_INSTALL_PACKAGE ?= · line 11

Quoted 1 line
meta/classes/pip_install_wheel.bbclass +0 -0
  PYPA_WHEEL ??=

"${PIP_INSTALL_DIST_PATH}/${PIP_INSTALL_PACKAGE}-*-*.whl"

meta/classes/pip_install_wheel.bbclass PIP_INSTALL_PACKAGE ?= "${@guess_pip_install_package_name(d)}"

Quoted 8 lines
meta/classes/pip_install_wheel.bbclass +1 -1
-PIP_INSTALL_ARGS ?= "\
+PIP_INSTALL_ARGS = "\
      -vvvv \
      --ignore-installed \
      --no-cache \
 

Hmm all of the classes use ?= and I think for a reason - this isn't the fault of the bbclass but of the recipe in the end, as += is known to cause this depending on where the additions have been added (before the inherit or after it) - I think the better way would be to use PIP_INSTALL_ARGS:append in the actual recipe - guess the fallout would be way less than the one I expect from this change.

The big question is if that should changeable by the user or not - I personally think it should be

Quoted 4 lines

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#162860):

https://lists.openembedded.org/g/openembedded-core/message/162860

Quoted 3 lines

Mute This Topic: https://lists.openembedded.org/mt/89621292/3647476
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [

[email protected]]

Quoted 2 lines

-=-=-=-=-=-=-=-=-=-=-=-

#6 lore raw
Quoted 1 line · Ross Burton

Personally I can’t see any reason to extend the pip install arguments. What option do you think would be used by a recipe?

For instance the --user option is something that I used once in a setup.
Plus --global-option for passing additional options into the installation scripting.
I give you that, that these are used rarely - and still could be used, if the recipes would be tweaked to append after the inherit statement.

And in my mind it was always like a variable with a weak assignment could be changed by the user, the ones with a hard assignment shouldn't be touched - but that could be just my mind 😅

Quoted 65 lines

Ross

On Mon, 7 Mar 2022 at 20:06, Konrad Weihmann <[email protected] <mailto:[email protected]>> wrote:

    On 07.03.22 20:42, Ross Burton wrote:
     > If we expect users to extend this we should use =, as otherwise a
    recipe
     > that does += will replace the default value.
     >
     > Signed-off-by: Ross Burton <[email protected]
    <mailto:[email protected]>>
     > ---
     >   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 c1680a24ed..febcc8e445 100644
     > --- a/meta/classes/pip_install_wheel.bbclass
     > +++ b/meta/classes/pip_install_wheel.bbclass
     > @@ -10,7 +10,7 @@ PIP_INSTALL_PACKAGE ?=
    "${@guess_pip_install_package_name(d)}"
     >   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 ?= "\
     > +PIP_INSTALL_ARGS = "\
     >       -vvvv \
     >       --ignore-installed \
     >       --no-cache \
     >
     >

    Hmm all of the classes use ?= and I think for a reason - this isn't the
    fault of the bbclass but of the recipe in the end, as += is known to
    cause this depending on where the additions have been added (before the
    inherit or after it) - I think the better way would be to use
    PIP_INSTALL_ARGS:append in the actual recipe - guess the fallout would
    be way less than the one I expect from this change.

    The big question is if that should changeable by the user or not - I
    personally think it should be

     >
     > -=-=-=-=-=-=-=-=-=-=-=-
     > Links: You receive all messages sent to this group.
     > View/Reply Online (#162860):
    https://lists.openembedded.org/g/openembedded-core/message/162860
    <https://lists.openembedded.org/g/openembedded-core/message/162860>
     > Mute This Topic:
    https://lists.openembedded.org/mt/89621292/3647476
    <https://lists.openembedded.org/mt/89621292/3647476>
     > Group Owner: [email protected]
    <mailto:openembedded-core%[email protected]>
     > Unsubscribe:
    https://lists.openembedded.org/g/openembedded-core/unsub
    <https://lists.openembedded.org/g/openembedded-core/unsub>
    [[email protected] <mailto:[email protected]>]
     > -=-=-=-=-=-=-=-=-=-=-=-
     >
#7 lore raw
Quoted 1 line · Konrad Weihmann

For instance the --user option is something that I used once in a setup.

This is the pip_install_wheel class for installing wheels to the system library directory, so --user wouldn't be useful surely?

Ross