diff mbox series

[meta-python] python3-incremental: improve packaging

Message ID 20240718172321.412136-1-gudni.m.g@gmail.com
State Accepted
Headers show
Series [meta-python] python3-incremental: improve packaging | expand

Commit Message

Guðni Már Gilbert July 18, 2024, 5:23 p.m. UTC
Summary of changes:
1. Create a new package: python3-incremental-tests
2. Create a new package: python3-incremental-scripts. This is an optional
package used to update Twisted locally on the command line. The package
requires python3-click. Most, if not all, users don't need this package.
3. There is no longer a circular dependency between python3-twisted and
python3-incremental at build time.
5. python3-incremental ipk package shrinks from 167 KiB to 32 KiB

Signed-off-by: Guðni Már Gilbert <gudni.m.g@gmail.com>
---
 .../python/python3-incremental_22.10.0.bb     | 27 ++++++++++++++-----
 1 file changed, 21 insertions(+), 6 deletions(-)

Comments

Khem Raj July 18, 2024, 6:28 p.m. UTC | #1
Thanks for doing this. These kind of changes are very helpful

On Thu, Jul 18, 2024 at 10:24 AM Guðni Már Gilbert via
lists.openembedded.org <gudni.m.g=gmail.com@lists.openembedded.org> wrote:

> Summary of changes:
> 1. Create a new package: python3-incremental-tests
> 2. Create a new package: python3-incremental-scripts. This is an optional
> package used to update Twisted locally on the command line. The package
> requires python3-click. Most, if not all, users don't need this package.
> 3. There is no longer a circular dependency between python3-twisted and
> python3-incremental at build time.
> 5. python3-incremental ipk package shrinks from 167 KiB to 32 KiB
>
> Signed-off-by: Guðni Már Gilbert <gudni.m.g@gmail.com>
> ---
>  .../python/python3-incremental_22.10.0.bb     | 27 ++++++++++++++-----
>  1 file changed, 21 insertions(+), 6 deletions(-)
>
> diff --git a/meta-python/recipes-devtools/python/
> python3-incremental_22.10.0.bb b/meta-python/recipes-devtools/python/
> python3-incremental_22.10.0.bb
> index 503ef35a9..007be032f 100644
> --- a/meta-python/recipes-devtools/python/python3-incremental_22.10.0.bb
> +++ b/meta-python/recipes-devtools/python/python3-incremental_22.10.0.bb
> @@ -7,13 +7,28 @@ SRC_URI[sha256sum] =
> "912feeb5e0f7e0188e6f42241d2f450002e11bbc0937c65865045854c2
>
>  inherit pypi python_setuptools_build_meta
>
> -RDEPENDS:${PN} += " \
> -    python3-twisted-core \
> +PACKAGE_BEFORE_PN = "\
> +    ${PN}-scripts \
> +    ${PN}-tests \
> +"
> +
> +FILES:${PN}-scripts = "\
> +    ${PYTHON_SITEPACKAGES_DIR}/incremental/update.py \
> +    ${PYTHON_SITEPACKAGES_DIR}/incremental/__pycache__/update*.pyc \
> +"
> +
> +RDEPENDS:${PN}-scripts = "\
>      python3-click \
> +    python3-twisted-core \
> +"
> +
> +FILES:${PN}-tests = "${PYTHON_SITEPACKAGES_DIR}/incremental/tests"
> +
> +# The tests require unit testing tool 'trial' from the twisted package
> +RDEPENDS:${PN}-tests = "\
> +    ${PN}-scripts \
> +    python3-twisted \
>  "
>
> -# -native is needed to build python[3]-twisted, however, we need to take
> steps to
> -# prevent a circular dependency. The build apparently does not use the
> part of
> -# python-incremental which uses python-twisted, so this hack is OK.
> -RDEPENDS:python3-incremental-native:remove = "python3-twisted-core-native"
>  BBCLASSEXTEND = "native"
> +
> --
> 2.34.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#111405):
> https://lists.openembedded.org/g/openembedded-devel/message/111405
> Mute This Topic: https://lists.openembedded.org/mt/107421002/1997914
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [
> raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
Ross Burton July 18, 2024, 7:07 p.m. UTC | #2
> On 18 Jul 2024, at 18:23, Guðni Már Gilbert via lists.openembedded.org <gudni.m.g=gmail.com@lists.openembedded.org> wrote:
> 
> Summary of changes:
> 1. Create a new package: python3-incremental-tests

Better would be to inherit ptest, put those files into python3-increment-ptest, and write a run-ptests that executes them.

No point packaging tests that don’t get run.

Cheers,
Ross
Guðni Már Gilbert July 18, 2024, 11:39 p.m. UTC | #3
Hi Ross,

The only reason I created the “tests” package is to avoid installing them in the final image via “python3-incremental”.

I agree about the ptests, it would be nice to have them.
diff mbox series

Patch

diff --git a/meta-python/recipes-devtools/python/python3-incremental_22.10.0.bb b/meta-python/recipes-devtools/python/python3-incremental_22.10.0.bb
index 503ef35a9..007be032f 100644
--- a/meta-python/recipes-devtools/python/python3-incremental_22.10.0.bb
+++ b/meta-python/recipes-devtools/python/python3-incremental_22.10.0.bb
@@ -7,13 +7,28 @@  SRC_URI[sha256sum] = "912feeb5e0f7e0188e6f42241d2f450002e11bbc0937c65865045854c2
 
 inherit pypi python_setuptools_build_meta
 
-RDEPENDS:${PN} += " \
-    python3-twisted-core \
+PACKAGE_BEFORE_PN = "\
+    ${PN}-scripts \
+    ${PN}-tests \
+"
+
+FILES:${PN}-scripts = "\
+    ${PYTHON_SITEPACKAGES_DIR}/incremental/update.py \
+    ${PYTHON_SITEPACKAGES_DIR}/incremental/__pycache__/update*.pyc \
+"
+
+RDEPENDS:${PN}-scripts = "\
     python3-click \
+    python3-twisted-core \
+"
+
+FILES:${PN}-tests = "${PYTHON_SITEPACKAGES_DIR}/incremental/tests"
+
+# The tests require unit testing tool 'trial' from the twisted package
+RDEPENDS:${PN}-tests = "\
+    ${PN}-scripts \
+    python3-twisted \
 "
 
-# -native is needed to build python[3]-twisted, however, we need to take steps to
-# prevent a circular dependency. The build apparently does not use the part of
-# python-incremental which uses python-twisted, so this hack is OK.
-RDEPENDS:python3-incremental-native:remove = "python3-twisted-core-native"
 BBCLASSEXTEND = "native"
+