summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Burton <ross@burtonini.com>2022-03-11 12:03:02 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-03-13 12:23:48 +0000
commita50bf48f900b4a67d622c9833c391b049a04d2da (patch)
tree765a69f48eb7a888bf9c2c3bf5eba20063c28973
parentb6a535068dadbc6540c6f5cf49cb9fba777fe727 (diff)
downloadpoky-a50bf48f900b4a67d622c9833c391b049a04d2da.tar.gz
meta: rename pip_install_wheel.bbclass to python_pep517.bbclass
pip_install_wheel shouldn't restricted to just using Pip to install wheels (the installer module is simplier and likely a better option), and in the future may be extended to also provide do_compile() using the build module. (From OE-Core rev: 3bdf64b97facce9706cc579bdbc9a80e0d48428f) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/flit_core.bbclass6
-rw-r--r--meta/classes/python_pep517.bbclass (renamed from meta/classes/pip_install_wheel.bbclass)27
-rw-r--r--meta/classes/setuptools3.bbclass8
-rw-r--r--meta/classes/setuptools_build_meta.bbclass6
-rw-r--r--meta/recipes-devtools/python/python3-flit-core_3.7.1.bb2
-rw-r--r--meta/recipes-devtools/python/python3-pip_22.0.3.bb2
-rw-r--r--meta/recipes-devtools/python/python3-setuptools_59.5.0.bb2
-rw-r--r--meta/recipes-devtools/python/python3-wheel_0.37.1.bb2
8 files changed, 29 insertions, 26 deletions
diff --git a/meta/classes/flit_core.bbclass b/meta/classes/flit_core.bbclass
index ce162bb75b..1ef8ce9429 100644
--- a/meta/classes/flit_core.bbclass
+++ b/meta/classes/flit_core.bbclass
@@ -1,4 +1,4 @@
1inherit pip_install_wheel python3native python3-dir setuptools3-base 1inherit python_pep517 python3native python3-dir setuptools3-base
2 2
3DEPENDS += "python3 python3-flit-core-native" 3DEPENDS += "python3 python3-flit-core-native"
4 4
@@ -12,8 +12,8 @@ PEP517_SOURCE_PATH ?= "${S}"
12# TODO: ideally this uses pypa/build 12# TODO: ideally this uses pypa/build
13flit_core_do_compile () { 13flit_core_do_compile () {
14 cd ${PEP517_SOURCE_PATH} 14 cd ${PEP517_SOURCE_PATH}
15 nativepython3 -mflit_core.wheel --outdir ${PIP_INSTALL_DIST_PATH} 15 nativepython3 -mflit_core.wheel --outdir ${PEP517_WHEEL_PATH}
16} 16}
17do_compile[cleandirs] += "${PIP_INSTALL_DIST_PATH}" 17do_compile[cleandirs] += "${PEP517_WHEEL_PATH}"
18 18
19EXPORT_FUNCTIONS do_configure do_compile 19EXPORT_FUNCTIONS do_configure do_compile
diff --git a/meta/classes/pip_install_wheel.bbclass b/meta/classes/python_pep517.bbclass
index 29cd544aa3..76660e70f8 100644
--- a/meta/classes/pip_install_wheel.bbclass
+++ b/meta/classes/python_pep517.bbclass
@@ -1,9 +1,12 @@
1# Common infrastructure for Python packages that use PEP-517 compliant packaging.
2# https://www.python.org/dev/peps/pep-0517/
3
1DEPENDS:append = " python3-pip-native" 4DEPENDS:append = " python3-pip-native"
2 5
3# The directory where wheels should be written too. Build classes 6# The directory where wheels should be written too. Build classes
4# will ideally [cleandirs] this but we don't do that here in case 7# will ideally [cleandirs] this but we don't do that here in case
5# a recipe wants to install prebuilt wheels. 8# a recipe wants to install prebuilt wheels.
6PIP_INSTALL_DIST_PATH ?= "${WORKDIR}/dist" 9PEP517_WHEEL_PATH ?= "${WORKDIR}/dist"
7 10
8PIP_INSTALL_ARGS = "\ 11PIP_INSTALL_ARGS = "\
9 -vvvv \ 12 -vvvv \
@@ -15,24 +18,24 @@ PIP_INSTALL_ARGS = "\
15 --prefix=${prefix} \ 18 --prefix=${prefix} \
16" 19"
17 20
18PIP_INSTALL_PYTHON = "python3" 21PEP517_INSTALL_PYTHON = "python3"
19PIP_INSTALL_PYTHON:class-native = "nativepython3" 22PEP517_INSTALL_PYTHON:class-native = "nativepython3"
20 23
21pip_install_wheel_do_install () { 24python_pep517_do_install () {
22 COUNT=$(find ${PIP_INSTALL_DIST_PATH} -name '*.whl' | wc -l) 25 COUNT=$(find ${PEP517_WHEEL_PATH} -name '*.whl' | wc -l)
23 if test $COUNT -eq 0; then 26 if test $COUNT -eq 0; then
24 bbfatal No wheels found in ${PIP_INSTALL_DIST_PATH} 27 bbfatal No wheels found in ${PEP517_WHEEL_PATH}
25 elif test $COUNT -gt 1; then 28 elif test $COUNT -gt 1; then
26 bbfatal More than one wheel found in ${PIP_INSTALL_DIST_PATH}, this should not happen 29 bbfatal More than one wheel found in ${PEP517_WHEEL_PATH}, this should not happen
27 fi 30 fi
28 31
29 nativepython3 -m pip install ${PIP_INSTALL_ARGS} ${PIP_INSTALL_DIST_PATH}/*.whl 32 nativepython3 -m pip install ${PIP_INSTALL_ARGS} ${PEP517_WHEEL_PATH}/*.whl
30 33
31 cd ${D} 34 cd ${D}
32 for i in ${D}${bindir}/* ${D}${sbindir}/*; do 35 for i in ${D}${bindir}/* ${D}${sbindir}/*; do
33 if [ -f "$i" ]; then 36 if [ -f "$i" ]; then
34 sed -i -e "1s,#!.*nativepython3,#!${USRBINPATH}/env ${PIP_INSTALL_PYTHON}," $i 37 sed -i -e "1s,#!.*nativepython3,#!${USRBINPATH}/env ${PEP517_INSTALL_PYTHON}," $i
35 sed -i -e "s:${PYTHON}:${USRBINPATH}/env\ ${PIP_INSTALL_PYTHON}:g" $i 38 sed -i -e "s:${PYTHON}:${USRBINPATH}/env\ ${PEP517_INSTALL_PYTHON}:g" $i
36 sed -i -e "s:${STAGING_BINDIR_NATIVE}:${bindir}:g" $i 39 sed -i -e "s:${STAGING_BINDIR_NATIVE}:${bindir}:g" $i
37 # Not everything we find may be Python, so ignore errors 40 # Not everything we find may be Python, so ignore errors
38 nativepython3 -mpy_compile $(realpath --relative-to=${D} $i) || true 41 nativepython3 -mpy_compile $(realpath --relative-to=${D} $i) || true
@@ -41,9 +44,9 @@ pip_install_wheel_do_install () {
41} 44}
42 45
43# A manual do_install that just uses unzip for bootstrapping purposes. Callers should DEPEND on unzip-native. 46# A manual do_install that just uses unzip for bootstrapping purposes. Callers should DEPEND on unzip-native.
44pip_install_wheel_do_bootstrap_install () { 47python_pep517_do_bootstrap_install () {
45 install -d ${D}${PYTHON_SITEPACKAGES_DIR} 48 install -d ${D}${PYTHON_SITEPACKAGES_DIR}
46 unzip -d ${D}${PYTHON_SITEPACKAGES_DIR} ${PIP_INSTALL_DIST_PATH}/*.whl 49 unzip -d ${D}${PYTHON_SITEPACKAGES_DIR} ${PEP517_WHEEL_PATH}/*.whl
47} 50}
48 51
49EXPORT_FUNCTIONS do_install 52EXPORT_FUNCTIONS do_install
diff --git a/meta/classes/setuptools3.bbclass b/meta/classes/setuptools3.bbclass
index dcf3561b8d..556bc801af 100644
--- a/meta/classes/setuptools3.bbclass
+++ b/meta/classes/setuptools3.bbclass
@@ -1,4 +1,4 @@
1inherit setuptools3-base pip_install_wheel 1inherit setuptools3-base python_pep517
2 2
3# bdist_wheel builds in ./dist 3# bdist_wheel builds in ./dist
4#B = "${WORKDIR}/build" 4#B = "${WORKDIR}/build"
@@ -17,14 +17,14 @@ setuptools3_do_compile() {
17 STAGING_INCDIR=${STAGING_INCDIR} \ 17 STAGING_INCDIR=${STAGING_INCDIR} \
18 STAGING_LIBDIR=${STAGING_LIBDIR} \ 18 STAGING_LIBDIR=${STAGING_LIBDIR} \
19 ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py \ 19 ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py \
20 bdist_wheel --verbose --dist-dir ${PIP_INSTALL_DIST_PATH} ${SETUPTOOLS_BUILD_ARGS} || \ 20 bdist_wheel --verbose --dist-dir ${PEP517_WHEEL_PATH} ${SETUPTOOLS_BUILD_ARGS} || \
21 bbfatal_log "'${PYTHON_PN} setup.py bdist_wheel ${SETUPTOOLS_BUILD_ARGS}' execution failed." 21 bbfatal_log "'${PYTHON_PN} setup.py bdist_wheel ${SETUPTOOLS_BUILD_ARGS}' execution failed."
22} 22}
23setuptools3_do_compile[vardepsexclude] = "MACHINE" 23setuptools3_do_compile[vardepsexclude] = "MACHINE"
24do_compile[cleandirs] += "${PIP_INSTALL_DIST_PATH}" 24do_compile[cleandirs] += "${PEP517_WHEEL_PATH}"
25 25
26setuptools3_do_install() { 26setuptools3_do_install() {
27 pip_install_wheel_do_install 27 python_pep517_do_install
28} 28}
29 29
30EXPORT_FUNCTIONS do_configure do_compile do_install 30EXPORT_FUNCTIONS do_configure do_compile do_install
diff --git a/meta/classes/setuptools_build_meta.bbclass b/meta/classes/setuptools_build_meta.bbclass
index 787fbd5f36..424be85608 100644
--- a/meta/classes/setuptools_build_meta.bbclass
+++ b/meta/classes/setuptools_build_meta.bbclass
@@ -1,4 +1,4 @@
1inherit pip_install_wheel setuptools3-base 1inherit setuptools3-base python_pep517
2 2
3DEPENDS += "python3-setuptools-native python3-wheel-native" 3DEPENDS += "python3-setuptools-native python3-wheel-native"
4 4
@@ -12,8 +12,8 @@ setuptools_build_meta_do_configure () {
12# TODO: ideally this uses pypa/build 12# TODO: ideally this uses pypa/build
13setuptools_build_meta_do_compile () { 13setuptools_build_meta_do_compile () {
14 cd ${PEP517_SOURCE_PATH} 14 cd ${PEP517_SOURCE_PATH}
15 nativepython3 -c "from setuptools import build_meta; build_meta.build_wheel('${PIP_INSTALL_DIST_PATH}')" 15 nativepython3 -c "from setuptools import build_meta; build_meta.build_wheel('${PEP517_WHEEL_PATH}')"
16} 16}
17do_compile[cleandirs] += "${PIP_INSTALL_DIST_PATH}" 17do_compile[cleandirs] += "${PEP517_WHEEL_PATH}"
18 18
19EXPORT_FUNCTIONS do_configure do_compile 19EXPORT_FUNCTIONS do_configure do_compile
diff --git a/meta/recipes-devtools/python/python3-flit-core_3.7.1.bb b/meta/recipes-devtools/python/python3-flit-core_3.7.1.bb
index 1f14345d50..b12b8e42d7 100644
--- a/meta/recipes-devtools/python/python3-flit-core_3.7.1.bb
+++ b/meta/recipes-devtools/python/python3-flit-core_3.7.1.bb
@@ -21,7 +21,7 @@ PYPI_PACKAGE = "flit"
21PEP517_SOURCE_PATH = "${S}/flit_core" 21PEP517_SOURCE_PATH = "${S}/flit_core"
22 22
23do_install:class-native () { 23do_install:class-native () {
24 pip_install_wheel_do_bootstrap_install 24 python_pep517_do_bootstrap_install
25} 25}
26 26
27PACKAGES =+ "${PN}-tests" 27PACKAGES =+ "${PN}-tests"
diff --git a/meta/recipes-devtools/python/python3-pip_22.0.3.bb b/meta/recipes-devtools/python/python3-pip_22.0.3.bb
index bce3b68861..bfeeee789c 100644
--- a/meta/recipes-devtools/python/python3-pip_22.0.3.bb
+++ b/meta/recipes-devtools/python/python3-pip_22.0.3.bb
@@ -19,7 +19,7 @@ SRC_URI += "file://reproducible.patch"
19SRC_URI[sha256sum] = "f29d589df8c8ab99c060e68ad294c4a9ed896624f6368c5349d70aa581b333d0" 19SRC_URI[sha256sum] = "f29d589df8c8ab99c060e68ad294c4a9ed896624f6368c5349d70aa581b333d0"
20 20
21do_install:class-native() { 21do_install:class-native() {
22 pip_install_wheel_do_bootstrap_install 22 python_pep517_do_bootstrap_install
23 23
24 # pip install would normally generate [console_scripts] in ${bindir} 24 # pip install would normally generate [console_scripts] in ${bindir}
25 install -d ${D}/${bindir} 25 install -d ${D}/${bindir}
diff --git a/meta/recipes-devtools/python/python3-setuptools_59.5.0.bb b/meta/recipes-devtools/python/python3-setuptools_59.5.0.bb
index 7cd67b85f9..d93972b9a0 100644
--- a/meta/recipes-devtools/python/python3-setuptools_59.5.0.bb
+++ b/meta/recipes-devtools/python/python3-setuptools_59.5.0.bb
@@ -22,7 +22,7 @@ DEPENDS:remove:class-native = "python3-pip-native python3-setuptools-native"
22DEPENDS:append:class-native = " unzip-native" 22DEPENDS:append:class-native = " unzip-native"
23 23
24do_install:class-native() { 24do_install:class-native() {
25 pip_install_wheel_do_bootstrap_install 25 python_pep517_do_bootstrap_install
26} 26}
27 27
28RDEPENDS:${PN} = "\ 28RDEPENDS:${PN} = "\
diff --git a/meta/recipes-devtools/python/python3-wheel_0.37.1.bb b/meta/recipes-devtools/python/python3-wheel_0.37.1.bb
index cf0d8191b4..a339e65824 100644
--- a/meta/recipes-devtools/python/python3-wheel_0.37.1.bb
+++ b/meta/recipes-devtools/python/python3-wheel_0.37.1.bb
@@ -13,7 +13,7 @@ SRC_URI += " file://0001-Backport-pyproject.toml-from-flit-backend-branch.patch"
13DEPENDS:remove:class-native = "python3-pip-native" 13DEPENDS:remove:class-native = "python3-pip-native"
14 14
15do_install:class-native () { 15do_install:class-native () {
16 pip_install_wheel_do_bootstrap_install 16 python_pep517_do_bootstrap_install
17 17
18 # pip install would normally generate [project.scripts] in ${bindir} 18 # pip install would normally generate [project.scripts] in ${bindir}
19 install -d ${D}/${bindir} 19 install -d ${D}/${bindir}