]> code.ossystems Code Review - openembedded-core.git/commitdiff
pip_install_wheel: add a generic do_install for bootstrapping
authorRoss Burton <ross@burtonini.com>
Thu, 10 Mar 2022 11:40:33 +0000 (11:40 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 11 Mar 2022 06:54:39 +0000 (06:54 +0000)
Several recipes are duplicating the same bootstrap logic for installing
a wheel without using any tools.  Add an implementation to
pip_install_wheel to centralise the code, and remove the duplicated code
from the following recipes:

- python3-flit-core
- python3-pip
- python3-setuptools
- python3-wheel

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/pip_install_wheel.bbclass
meta/recipes-devtools/python/python3-flit-core_3.7.1.bb
meta/recipes-devtools/python/python3-pip_22.0.3.bb
meta/recipes-devtools/python/python3-setuptools_59.5.0.bb
meta/recipes-devtools/python/python3-wheel_0.37.1.bb

index 3861dae75ab47e029f7c86d3b0ba3566358666ea..29cd544aa3d1ad3316ac0ccbc9e86fb1af74afe6 100644 (file)
@@ -40,4 +40,10 @@ pip_install_wheel_do_install () {
     done
 }
 
+# A manual do_install that just uses unzip for bootstrapping purposes. Callers should DEPEND on unzip-native.
+pip_install_wheel_do_bootstrap_install () {
+    install -d ${D}${PYTHON_SITEPACKAGES_DIR}
+    unzip -d ${D}${PYTHON_SITEPACKAGES_DIR} ${PIP_INSTALL_DIST_PATH}/*.whl
+}
+
 EXPORT_FUNCTIONS do_install
index 55ce2565509ef2006fd22112098e0da6c374bc7d..c6bc24555eae396eb0a2296a120669e0057abe33 100644 (file)
@@ -22,8 +22,7 @@ PEP517_SOURCE_PATH = "${S}/flit_core"
 PIP_INSTALL_PACKAGE = "flit_core"
 
 do_install:class-native () {
-    install -d ${D}${PYTHON_SITEPACKAGES_DIR}
-    unzip -d ${D}${PYTHON_SITEPACKAGES_DIR} ${PIP_INSTALL_DIST_PATH}/flit_core*.whl
+    pip_install_wheel_do_bootstrap_install
 }
 
 PACKAGES =+ "${PN}-tests"
index 50cc8206de78d503bebd71130fb9018a63054ff9..bce3b68861a943b4dd384b118c5b25be335db56d 100644 (file)
@@ -19,9 +19,7 @@ SRC_URI += "file://reproducible.patch"
 SRC_URI[sha256sum] = "f29d589df8c8ab99c060e68ad294c4a9ed896624f6368c5349d70aa581b333d0"
 
 do_install:class-native() {
-    # Bootstrap to prevent dependency loop in python3-pip-native
-    install -d ${D}${PYTHON_SITEPACKAGES_DIR}
-    unzip -d ${D}${PYTHON_SITEPACKAGES_DIR} ${PIP_INSTALL_DIST_PATH}/*.whl
+    pip_install_wheel_do_bootstrap_install
 
     # pip install would normally generate [console_scripts] in ${bindir}
     install -d ${D}/${bindir}
index 9d2c2fd74441e1fe406c15b7a8ad82169a90183d..7cd67b85f9d072173efc1293fa04464613478ee3 100644 (file)
@@ -22,9 +22,7 @@ DEPENDS:remove:class-native = "python3-pip-native python3-setuptools-native"
 DEPENDS:append:class-native = " unzip-native"
 
 do_install:class-native() {
-    # Bootstrap to prevent dependency loop in python3-pip-native
-    install -d ${D}${PYTHON_SITEPACKAGES_DIR}
-    unzip -d ${D}${PYTHON_SITEPACKAGES_DIR} ${PIP_INSTALL_DIST_PATH}/*.whl
+    pip_install_wheel_do_bootstrap_install
 }
 
 RDEPENDS:${PN} = "\
index 83a7c986a801e9b39f70aae6c0ab509bba474484..cf0d8191b4da37bdc1e4193c1e771693cc46fd9a 100644 (file)
@@ -13,9 +13,7 @@ SRC_URI += " file://0001-Backport-pyproject.toml-from-flit-backend-branch.patch"
 DEPENDS:remove:class-native = "python3-pip-native"
 
 do_install:class-native () {
-    # We need to bootstrap python3-wheel-native
-    install -d ${D}${PYTHON_SITEPACKAGES_DIR}
-    unzip -d ${D}${PYTHON_SITEPACKAGES_DIR} ${PIP_INSTALL_DIST_PATH}/*.whl
+    pip_install_wheel_do_bootstrap_install
 
     # pip install would normally generate [project.scripts] in ${bindir}
     install -d ${D}/${bindir}