Skip to contentSkip to conversation

python3-incremental: improve packaging

PATCH In review Guðni Már Gilbert 3 participants 4 messages Jul 18, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 python3-incremental: improve packaging

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

---
 .../python/python3-incremental_22.10.0.bb     | 27 ++++++++++++++-----
 1 file changed, 21 insertions(+), 6 deletions(-)
meta-python/recipes-devtools/python/python3-incremental_22.10.0.bb +21 -6
index 503ef35a9..007be032f 100644
@@ -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"
+
Signature · 1 line
2.34.1
#1 lore raw

Thanks for doing this. These kind of changes are very helpful

Quoted 73 lines · Guðni Már Gilbert via lists.openembedded.org

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

---
 .../python/python3-incremental_22.10.0.bb     | 27 ++++++++++++++-----
 1 file changed, 21 insertions(+), 6 deletions(-)
(quoted diff) +0 -0

python3-incremental_22.10.0.bb b/meta-python/recipes-devtools/python/ python3-incremental_22.10.0.bb
index 503ef35a9..007be032f 100644

meta-python/recipes-devtools/python/python3-incremental_22.10.0.bb +0 -0
@@ -7,13 +7,28 @@ SRC_URI[sha256sum] =

"912feeb5e0f7e0188e6f42241d2f450002e11bbc0937c65865045854c2

inherit pypi python_setuptools_build_meta

meta-python/recipes-devtools/python/python3-incremental_22.10.0.bb +20 -3
-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

meta-python/recipes-devtools/python/python3-incremental_22.10.0.bb +1 -3
-# 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: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw
In reply to Guðni Már Gilbert
Quoted 5 lines · Guðni Már Gilbert via lists.openembedded.org

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

#3 lore raw

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.