Skip to contentSkip to conversation

package/python-docker: needs python-packaging after bump to 6.0.1

PATCH In review Peter Korsgaard 2 participants 7 messages Jun 16, 2023 – Jul 6, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 package/python-docker: needs python-packaging after bump to 6.0.1

Commit d680db0ba77dab (package/python-docker: bump to version 6.0.1) forgot to add the new dependency on python-packaging, leading to runtime errors:

import docker

    File "/usr/lib/python3.11/site-packages/docker/__init__.py", line 2, in <module>
    File "/usr/lib/python3.11/site-packages/docker/api/__init__.py", line 2, in <module>
    File "/usr/lib/python3.11/site-packages/docker/api/client.py", line 10, in <module>
    File "/usr/lib/python3.11/site-packages/docker/auth.py", line 7, in <module>
    File "/usr/lib/python3.11/site-packages/docker/utils/__init__.py", line 3, in <module>
    File "/usr/lib/python3.11/site-packages/docker/utils/decorators.py", line 4, in <module>
    File "/usr/lib/python3.11/site-packages/docker/utils/utils.py", line 9, in <module>

ModuleNotFoundError: No module named 'packaging'

---
 package/python-docker/Config.in | 1 +
 1 file changed, 1 insertion(+)
package/python-docker/Config.in +1 -0
index b2296f42eb..ae5a7a5181 100644
@@ -2,6 +2,7 @@ config BR2_PACKAGE_PYTHON_DOCKER
 	bool "python-docker"
 	# docker-engine may be running on another host, so no other dependency
 	select BR2_PACKAGE_PYTHON3_SSL # runtime
+	select BR2_PACKAGE_PYTHON_PACKAGING # runtime
 	select BR2_PACKAGE_PYTHON_REQUESTS # runtime
 	select BR2_PACKAGE_PYTHON_SIX # runtime
 	select BR2_PACKAGE_PYTHON_WEBSOCKET_CLIENT # runtime
Signature · 6 lines
2.30.2

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH 2/2 support/testing: add python-docker test

Python-docker needs a working docker setup to do anything useful, so add it to the existing docker_compose (which tests docker and docker-compose) rather than adding a completely new test.

---
 .../testing/tests/package/sample_python_docker.py    | 12 ++++++++++++
 support/testing/tests/package/test_docker_compose.py | 10 +++++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)
 create mode 100644 support/testing/tests/package/sample_python_docker.py
support/testing/tests/package/sample_python_docker.py new file +12 -0
new file mode 100644
index 0000000000..a69097b412
@@ -0,0 +1,12 @@
+import docker
+
+client = docker.from_env()
+info = client.info()
+images = client.images.list()
+
+assert len(images) > 0
+
+print('Version:', info['ServerVersion'])
+print('Images:')
+for i in images:
+    print(i.tags[0])
support/testing/tests/package/test_docker_compose.py +9 -1
index 38b669fc6d..16027c9c3a 100644
@@ -4,6 +4,8 @@ import infra.basetest
 
 
 class TestDockerCompose(infra.basetest.BRTest):
+    scripts = ["conf/docker-compose.yml",
+               "tests/package/sample_python_docker.py"]
     config = \
         """
         BR2_x86_64=y
@@ -18,6 +20,8 @@ class TestDockerCompose(infra.basetest.BRTest):
         BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.19.262"
         BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
         BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="{}"
+        BR2_PACKAGE_PYTHON3=y
+        BR2_PACKAGE_PYTHON_DOCKER=y
         BR2_PACKAGE_CA_CERTIFICATES=y
         BR2_PACKAGE_DOCKER_CLI=y
         BR2_PACKAGE_DOCKER_COMPOSE=y
@@ -27,7 +31,7 @@ class TestDockerCompose(infra.basetest.BRTest):
         # BR2_TARGET_ROOTFS_TAR is not set
         """.format(
             infra.filepath("tests/package/copy-sample-script-to-target.sh"),
-            infra.filepath("conf/docker-compose.yml"),
+            " ".join([infra.filepath(i) for i in scripts]),
             infra.filepath("conf/docker-compose-kernel.config"))
 
     def wait_for_dockerd(self):
@@ -46,6 +50,9 @@ class TestDockerCompose(infra.basetest.BRTest):
         self.assertRunOk('wget -q -O /tmp/busybox http://127.0.0.1/busybox', 120)
         self.assertRunOk('cmp /bin/busybox /tmp/busybox', 120)
 
+    def python_docker_test(self):
+        self.assertRunOk('python3 ./sample_python_docker.py', 120)
+
     def test_run(self):
         kernel = os.path.join(self.builddir, "images", "bzImage")
         rootfs = os.path.join(self.builddir, "images", "rootfs.ext2")
@@ -62,3 +69,4 @@ class TestDockerCompose(infra.basetest.BRTest):
         self.wait_for_dockerd()
         self.docker_test()
         self.docker_compose_test()
+        self.python_docker_test()
Signature · 6 lines
2.30.2

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Reviewed-by Christian Stewart on v1 2/2
#2 lore raw

Re: [Buildroot] [PATCH 2/2] support/testing: add python-docker test

Hi Peter,

Lgtm,

Quoted 77 lines · Peter Korsgaard

Python-docker needs a working docker setup to do anything useful, so add it to the existing docker_compose (which tests docker and docker-compose) rather than adding a completely new test.

---
 .../testing/tests/package/sample_python_docker.py    | 12 ++++++++++++
 support/testing/tests/package/test_docker_compose.py | 10 +++++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)
 create mode 100644 support/testing/tests/package/sample_python_docker.py
support/testing/tests/package/sample_python_docker.py new file +12 -0
new file mode 100644
index 0000000000..a69097b412
@@ -0,0 +1,12 @@
+import docker
+
+client = docker.from_env()
+info = client.info()
+images = client.images.list()
+
+assert len(images) > 0
+
+print('Version:', info['ServerVersion'])
+print('Images:')
+for i in images:
+    print(i.tags[0])
support/testing/tests/package/test_docker_compose.py +9 -2
index 38b669fc6d..16027c9c3a 100644
@@ -4,6 +4,8 @@ import infra.basetest
 
 
 class TestDockerCompose(infra.basetest.BRTest):
+    scripts = ["conf/docker-compose.yml",
+               "tests/package/sample_python_docker.py"]
     config = \
         """
         BR2_x86_64=y
@@ -18,6 +20,8 @@ class TestDockerCompose(infra.basetest.BRTest):
         BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.19.262"
         BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
         BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="{}"
+        BR2_PACKAGE_PYTHON3=y
+        BR2_PACKAGE_PYTHON_DOCKER=y
         BR2_PACKAGE_CA_CERTIFICATES=y
         BR2_PACKAGE_DOCKER_CLI=y
         BR2_PACKAGE_DOCKER_COMPOSE=y
@@ -27,7 +31,7 @@ class TestDockerCompose(infra.basetest.BRTest):
         # BR2_TARGET_ROOTFS_TAR is not set
         """.format(
             infra.filepath("tests/package/copy-sample-script-to-target.sh"),
-            infra.filepath("conf/docker-compose.yml"),
+            " ".join([infra.filepath(i) for i in scripts]),
             infra.filepath("conf/docker-compose-kernel.config"))
 
     def wait_for_dockerd(self):
@@ -46,6 +50,9 @@ class TestDockerCompose(infra.basetest.BRTest):
         self.assertRunOk('wget -q -O /tmp/busybox http://127.0.0.1/busybox', 120)
         self.assertRunOk('cmp /bin/busybox /tmp/busybox', 120)
 
+    def python_docker_test(self):
+        self.assertRunOk('python3 ./sample_python_docker.py', 120)
+
     def test_run(self):
         kernel = os.path.join(self.builddir, "images", "bzImage")
         rootfs = os.path.join(self.builddir, "images", "rootfs.ext2")
@@ -62,3 +69,4 @@ class TestDockerCompose(infra.basetest.BRTest):
         self.wait_for_dockerd()
         self.docker_test()
         self.docker_compose_test()
+        self.python_docker_test()
--
Quoted 2 lines

2.30.2

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw

Re: [Buildroot] [PATCH 2/2] support/testing: add python-docker test

In reply to Peter Korsgaard
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Peter" == Peter Korsgaard <[email protected]> writes:

Python-docker needs a working docker setup to do anything useful, so add it to the existing docker_compose (which tests docker and docker-compose) rather than adding a completely new test.

Committed, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#4 lore raw

Re: [Buildroot] [PATCH 2/2] support/testing: add python-docker test

Quoted 10 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

"Peter" == Peter Korsgaard <[email protected]> writes:

"Peter" == Peter Korsgaard <[email protected]> writes:

Python-docker needs a working docker setup to do anything useful, so add it to the existing docker_compose (which tests docker and docker-compose) rather than adding a completely new test.

Committed, thanks.

Committed to 2023.02.x and 2023.05.x, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#5 lore raw
In reply to Peter Korsgaard
Quoted 13 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Peter" == Peter Korsgaard <[email protected]> writes:

Commit d680db0ba77dab (package/python-docker: bump to version 6.0.1) forgot to add the new dependency on python-packaging, leading to runtime errors:

import docker

    File "/usr/lib/python3.11/site-packages/docker/__init__.py", line 2, in <module>
    File "/usr/lib/python3.11/site-packages/docker/api/__init__.py", line 2, in <module>
    File "/usr/lib/python3.11/site-packages/docker/api/client.py", line 10, in <module>
    File "/usr/lib/python3.11/site-packages/docker/auth.py", line 7, in <module>
    File "/usr/lib/python3.11/site-packages/docker/utils/__init__.py", line 3, in <module>
    File "/usr/lib/python3.11/site-packages/docker/utils/decorators.py", line 4, in <module>
    File "/usr/lib/python3.11/site-packages/docker/utils/utils.py", line 9, in <module>
Quoted 3 lines

ModuleNotFoundError: No module named 'packaging'

Committed, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#6 lore raw
Quoted 15 lines
Quoted 14 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Peter" == Peter Korsgaard <[email protected]> writes:

Commit d680db0ba77dab (package/python-docker: bump to version 6.0.1) forgot to add the new dependency on python-packaging, leading to runtime errors:

import docker
File "/usr/lib/python3.11/site-packages/docker/__init__.py", line 2, in <module> File "/usr/lib/python3.11/site-packages/docker/api/__init__.py", line 2, in <module> File "/usr/lib/python3.11/site-packages/docker/api/client.py", line 10, in <module> File "/usr/lib/python3.11/site-packages/docker/auth.py", line 7, in <module> File "/usr/lib/python3.11/site-packages/docker/utils/__init__.py", line 3, in <module> File "/usr/lib/python3.11/site-packages/docker/utils/decorators.py", line 4, in <module> File "/usr/lib/python3.11/site-packages/docker/utils/utils.py", line 9, in <module>
ModuleNotFoundError: No module named 'packaging'

Quoted 3 lines
Quoted 1 line

Committed, thanks.

Committed to 2023.02.x and 2023.05.x, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot