From patchwork Mon Nov 30 13:38:31 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 106491 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.32521.1796045921630445687 for ; Mon, 30 Nov 2026 05:38:41 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@arm.com header.s=foss header.b=dGYZAyke; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4D37B1650 for ; Mon, 30 Nov 2026 05:38:38 -0800 (PST) Received: from cesw-amp-gbt-1s-m12830-04.lab.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B4C9A3F86F for ; Mon, 30 Nov 2026 05:38:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1796045921; bh=pUrjcHy6vhc9b0B7GKCy1bSRx5j8Nh4p7uRtLCR6gxA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=dGYZAykegye3PQybZBTKnJ0VPko+pYFs9FwmoJU061srLJqfrM+8VSxudQNyn3sPA qLemcri1y+9yfY35pfmsXthjBwgt3M7ttGIEGQ9CAincTgpoUpyFmbtd6Y+gF6MTtx GIKBlVrimVpE5JMxkpkbO8/49na26hnjV4ACHQgY= From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [RFC PATCH 1/3] pypi: add provides for the pypi package name Date: Mon, 30 Nov 2026 13:38:31 +0000 Message-ID: <20261130133833.2868171-2-ross.burton@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261130133833.2868171-1-ross.burton@arm.com> References: <20261130133833.2868171-1-ross.burton@arm.com> MIME-Version: 1.0 X-ARM-No-Footer: NoDisclaimer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Mon, 30 Nov 2026 13:38:48 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/251599 TODO: nativesdk names are missing. --- meta/classes-recipe/pypi.bbclass | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/meta/classes-recipe/pypi.bbclass b/meta/classes-recipe/pypi.bbclass index e45e3115305..6a5217f3da5 100644 --- a/meta/classes-recipe/pypi.bbclass +++ b/meta/classes-recipe/pypi.bbclass @@ -73,3 +73,8 @@ def pypi_package_normalise(s): """ import re return re.sub(r"[-_.]+", "-", s).lower() + +# virtual provide for the package name +# TODO: better prefix than pypi-? +RPROVIDES:${PN} += "pypi-package-${PYPI_PACKAGE}" +PROVIDES:append:class-native = "pypi-package-${PYPI_PACKAGE}-native" From patchwork Mon Nov 30 13:38:32 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 106492 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.32522.1796045922516206882 for ; Mon, 30 Nov 2026 05:38:42 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@arm.com header.s=foss header.b=uBcWXeCD; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0118C1575 for ; Mon, 30 Nov 2026 05:38:39 -0800 (PST) Received: from cesw-amp-gbt-1s-m12830-04.lab.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 75EC43F86F for ; Mon, 30 Nov 2026 05:38:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1796045921; bh=fqqkjJfZdCXDU8cAeApaP/7VwJCHh+Hy6SE+xSM5qhw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=uBcWXeCDjGlTzRh0MT5EdlGeH5kOQtLkj4ZAgpEjeowDQwnt8jv8nl0MeF4G/hWUh EnlnbwBzaSTKHUai2M+CvPte9DnhvPrQ+fqW92EQ8tJws8s9C29X5eS+/lTU5rcQhn hRsOqchI1MrMWN/LUoPL/TqAHtAANoiXuo9EGLWg= From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [RFC PATCH 2/3] classes: add pydeps class Date: Mon, 30 Nov 2026 13:38:32 +0000 Message-ID: <20261130133833.2868171-3-ross.burton@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261130133833.2868171-1-ross.burton@arm.com> References: <20261130133833.2868171-1-ross.burton@arm.com> MIME-Version: 1.0 X-ARM-No-Footer: NoDisclaimer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Mon, 30 Nov 2026 13:38:48 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/251600 Following the pattern of the go and rust classes, this examines a source tree and writes an include file with the build and runtime dependencies. TODO: also extract license? --- meta/classes-recipe/pydeps.bbclass | 8 +++ meta/files/py-update-requires.py | 81 ++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 meta/classes-recipe/pydeps.bbclass create mode 100755 meta/files/py-update-requires.py diff --git a/meta/classes-recipe/pydeps.bbclass b/meta/classes-recipe/pydeps.bbclass new file mode 100644 index 00000000000..2f1265de4fb --- /dev/null +++ b/meta/classes-recipe/pydeps.bbclass @@ -0,0 +1,8 @@ +do_update_python_requires() { + nativepython3 ${COREBASE}/meta/files/py-update-requires.py ${PEP517_SOURCE_PATH} -o ${THISDIR}/${BPN}-python-deps.inc +} +addtask do_update_python_requires after do_patch +do_update_python_requires[depends] = "python3-native:do_populate_sysroot python3-build-native:do_populate_sysroot" +do_update_python_requires[nostamp] = "1" + +RECIPE_UPGRADE_EXTRA_TASKS += "do_update_python_requires" diff --git a/meta/files/py-update-requires.py b/meta/files/py-update-requires.py new file mode 100755 index 00000000000..f5cbaf89f83 --- /dev/null +++ b/meta/files/py-update-requires.py @@ -0,0 +1,81 @@ +#! /usr/bin/env python3 + +import argparse +import importlib.metadata +import pathlib +import sys +import tempfile + +from build import ProjectBuilder +from packaging.requirements import Requirement +from packaging.utils import canonicalize_name + + +def get_build_depends(builder: ProjectBuilder): + deps = builder.build_system_requires | builder.get_requires_for_build("wheel") + return [Requirement(dep) for dep in deps] + + +def get_runtime_dependencies(builder, environment=None): + with tempfile.TemporaryDirectory() as tmpdir: + metadata_dir = builder.prepare("wheel", tmpdir) + if metadata_dir is None: + raise RuntimeError( + f"Backend {builder._backend} does not support metadata-only generation" + ) + metadata = importlib.metadata.PathDistribution( + pathlib.Path(metadata_dir) + ).metadata + + requirements = (Requirement(dep) for dep in metadata.get_all("Requires-Dist", [])) + + return [ + req + for req in requirements + if req.marker is None or req.marker.evaluate(environment) + ] + + +def generate_depends(dependencies, native=False): + names = {dep.name for dep in dependencies} + + return [f"pypi-package-{canonicalize_name(dep)}{'-native' if native else ''}" for dep in sorted(names)] + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("package_dir", type=pathlib.Path) + parser.add_argument("-o", "--output", required=True, type=pathlib.Path) + args = parser.parse_args() + + if not args.package_dir.is_dir(): + print(f"{args.package_dir} is not a directory") + return 1 + + print(f"Looking at dependencies in {args.package_dir}") + builder = ProjectBuilder(args.package_dir) + print(f"Project uses {builder._backend} as the builder") + + build_deps = get_build_depends(builder) + runtime_deps = get_runtime_dependencies(builder) + + print("Build dependencies") + print(" ".join(generate_depends(build_deps))) + print("Runtime dependencies") + print(" ".join(generate_depends(runtime_deps))) + + with args.output.open("wt") as f: + print( + f"""# Generated by py-update-requires +# DO NOT EDIT BY HAND + +DEPENDS += "{" ".join(generate_depends(build_deps, native=True))}" + +RDEPENDS:${{PN}} += "{" ".join(generate_depends(runtime_deps))}" +""", + file=f, + ) + + +if __name__ == "__main__": + sys.exit(main()) From patchwork Mon Nov 30 13:38:33 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 106490 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.32523.1796045923237560647 for ; Mon, 30 Nov 2026 05:38:43 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@arm.com header.s=foss header.b=bUfPgbif; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id ABA9B1650 for ; Mon, 30 Nov 2026 05:38:39 -0800 (PST) Received: from cesw-amp-gbt-1s-m12830-04.lab.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 2ADAD3F86F for ; Mon, 30 Nov 2026 05:38:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1796045922; bh=RkwSSqmucZp5H69a5o3AxAsjKhKhZqKPlMazqbUhJtw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=bUfPgbifAahxiAXNfKSBHOVKvIEYXQpedCGhkRED83/gRJY1xzNFWWPohbsbgHSjh S+G+WX4J28pNP/AgxPBp8ULfrRsEKr1lRhwCvAyJviADWyaSkaXg3sfCIuq19EsNsy 5Z2jdbUKJX5FemoWGrHd7kdm1FtYhvHMBAybi3FE= From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [RFC PATCH 3/3] license-expression: use class Date: Mon, 30 Nov 2026 13:38:33 +0000 Message-ID: <20261130133833.2868171-4-ross.burton@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261130133833.2868171-1-ross.burton@arm.com> References: <20261130133833.2868171-1-ross.burton@arm.com> MIME-Version: 1.0 X-ARM-No-Footer: NoDisclaimer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Mon, 30 Nov 2026 13:38:48 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/251601 --- .../python/python3-license-expression-python-deps.inc | 8 ++++++++ .../python/python3-license-expression_30.4.4.bb | 7 +++---- 2 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 meta/recipes-devtools/python/python3-license-expression-python-deps.inc diff --git a/meta/recipes-devtools/python/python3-license-expression-python-deps.inc b/meta/recipes-devtools/python/python3-license-expression-python-deps.inc new file mode 100644 index 00000000000..ca5cc32ccf1 --- /dev/null +++ b/meta/recipes-devtools/python/python3-license-expression-python-deps.inc @@ -0,0 +1,8 @@ + +# Generated by py-update-requires +# DO NOT EDIT BY HAND + +DEPENDS += "pypi-package-setuptools-native pypi-package-setuptools-scm-native pypi-package-wheel-native" + +RDEPENDS:${PN} += "pypi-package-boolean-py" + diff --git a/meta/recipes-devtools/python/python3-license-expression_30.4.4.bb b/meta/recipes-devtools/python/python3-license-expression_30.4.4.bb index 38db3951534..54af50f65e3 100644 --- a/meta/recipes-devtools/python/python3-license-expression_30.4.4.bb +++ b/meta/recipes-devtools/python/python3-license-expression_30.4.4.bb @@ -8,13 +8,9 @@ SRC_URI[sha256sum] = "73448f0aacd8d0808895bdc4b2c8e01a8d67646e4188f887375398c761 inherit pypi ptest-python-pytest python_setuptools_build_meta -DEPENDS += "python3-setuptools-scm-native python3-wheel-native" - RDEPENDS:${PN} += "\ - python3-booleanpy \ python3-core \ python3-json \ - python3-stringold \ python3-logging \ " @@ -26,3 +22,6 @@ do_install_ptest:append() { ln -s ${PYTHON_SITEPACKAGES_DIR}/license_expression/ ${D}${PTEST_PATH}/src/ install -m644 ${S}/setup.cfg ${D}${PTEST_PATH}/ } + +inherit pydeps +include ${BPN}-python-deps.inc