Skip to contentSkip to conversation

package/python-varlink: new package

PATCH Applied Marcus Hoffmann via buildroot 2 participants 4 messages Nov 24, 2025 – Dec 27, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 package/python-varlink: new package

There are currently problems in updating the pypi.org release[1], so we pull the package from the github generated tarball instead. This in turn then requires manually setting the version for setuptools_scm in the environment.

[1] https://github.com/varlink/python/issues/81

---
 DEVELOPERS                                 |  1 +
 package/Config.in                          |  1 +
 package/python-varlink/Config.in           |  6 ++++++
 package/python-varlink/python-varlink.hash |  3 +++
 package/python-varlink/python-varlink.mk   | 15 +++++++++++++++
 5 files changed, 26 insertions(+)
 create mode 100644 package/python-varlink/Config.in
 create mode 100644 package/python-varlink/python-varlink.hash
 create mode 100644 package/python-varlink/python-varlink.mk
DEVELOPERS +1 -0
index db001d6bb0..658023a4f4 100644
@@ -2273,6 +2273,7 @@ F:	package/python-ruamel-yaml-clib/
 F:	package/python-typing-inspection/
 F:	package/python-tzlocal/
 F:	package/python-sdbus-modemmanager/
+F:	package/python-varlink/
 F:	package/python-waitress/
 F:	package/python-whitenoise/
 F:	support/testing/tests/package/test_python_apscheduler.py
package/Config.in +1 -0
index 12f327cb27..2fb9cd8472 100644
@@ -1476,6 +1476,7 @@ menu "External python modules"
 	source "package/python-uvicorn/Config.in"
 	source "package/python-uvloop/Config.in"
 	source "package/python-validators/Config.in"
+	source "package/python-varlink/Config.in"
 	source "package/python-versiontools/Config.in"
 	source "package/python-visitor/Config.in"
 	source "package/python-waitress/Config.in"
package/python-varlink/Config.in new file +6 -0
new file mode 100644
index 0000000000..609fa22219
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_PYTHON_VARLINK
+	bool "python-varlink"
+	help
+	  Python implementation of the Varlink protocol.
+
+	  https://github.com/varlink/python
package/python-varlink/python-varlink.hash new file +3 -0
new file mode 100644
index 0000000000..5d8dfa9d8e
@@ -0,0 +1,3 @@
+# Locally computed sha256 checksums
+sha256  d31aee370ded51bc2bf8ad375fcd8b4cf3b7587306c0e05cffb45026ea9b9c40  python-varlink-32.1.0.tar.gz
+sha256  b40930bbcf80744c86c46a12bc9da056641d722716c378f5659b9e555ef833e1  LICENSE.txt
package/python-varlink/python-varlink.mk new file +15 -0
new file mode 100644
index 0000000000..1180cc4cc3
@@ -0,0 +1,15 @@
+################################################################################
+#
+# python-varlink
+#
+################################################################################
+
+PYTHON_VARLINK_VERSION = 32.1.0
+PYTHON_VARLINK_SITE = $(call github,varlink,python,$(PYTHON_VARLINK_VERSION))
+PYTHON_VARLINK_SETUP_TYPE = setuptools
+PYTHON_VARLINK_DEPENDENCIES = host-python-setuptools-scm
+PYTHON_VARLINK_LICENSE = Apache-2.0
+PYTHON_VARLINK_LICENSE_FILES = LICENSE.txt
+PYTHON_VARLINK_ENV = SETUPTOOLS_SCM_PRETEND_VERSION_FOR_VARLINK=$(PYTHON_VARLINK_VERSION)
+
+$(eval $(python-package))
Signature · 6 lines
2.52.0

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

PATCH 2/2 support/testing: python-varlink: new runtime test

Add new runtime test for python-varlink. Add this in a subdirectory, so the separate example interface file (which should be named in reverse DNS notation) does not sit loosly in the general package test dir.

As always when we need to start a separate server process inside a test case this gets slightly fiddly.

We override the test_run() function to first start the varlink example server, then call the packages cli interface to do a varlink call against the server. The cli defaults to pretty printing the result, which makes it more annoying to compare to the expected result in the test case, so we un-prettyprint it with python's builtin json.tool module.

---
 DEVELOPERS                                    |  1 +
 .../org.example.test.varlink                  |  5 +++
 .../sample_python_varlink.py                  | 22 +++++++++++++
 .../test_python_varlink.py                    | 31 +++++++++++++++++++
 4 files changed, 59 insertions(+)
 create mode 100644 support/testing/tests/package/test_python_varlink/org.example.test.varlink
 create mode 100644 support/testing/tests/package/test_python_varlink/sample_python_varlink.py
 create mode 100644 support/testing/tests/package/test_python_varlink/test_python_varlink.py
DEVELOPERS +1 -0
index 658023a4f4..695b738d7e 100644
@@ -2285,6 +2285,7 @@ F:	support/testing/tests/package/test_python_pydantic_settings.py
 F:	support/testing/tests/package/test_python_ruamel_yaml.py
 F:	support/testing/tests/package/test_python_sdbus_modemmanager.py
 F:	support/testing/tests/package/test_python_tzlocal.py
+F:	support/testing/tests/package/test_python_varlink/
 F:	support/testing/tests/package/test_python_waitress.py
 F:	support/testing/tests/package/test_python_whitenoise.py
 F:	support/testing/tests/package/sample_python_apscheduler.py
support/testing/tests/package/test_python_varlink/org.example.test.varlink new file +5 -0
new file mode 100644
index 0000000000..c199824e6e
@@ -0,0 +1,5 @@
+# Example Varlink service
+interface org.example.test
+
+# Returns the same string
+method Ping(ping: string) -> (pong: string)
support/testing/tests/package/test_python_varlink/sample_python_varlink.py new file +22 -0
new file mode 100644
index 0000000000..6cf0378d88
@@ -0,0 +1,22 @@
+import os
+
+import varlink
+
+service = varlink.Service(interface_dir=os.path.dirname(__file__))
+
+
+class ServiceRequestHandler(varlink.RequestHandler):
+    service = service
+
+
[email protected]("org.example.test")
+class Example:
+    def Ping(self, ping):
+        return {"pong": ping}
+
+def run_server(address):
+    with varlink.ThreadingServer(address, ServiceRequestHandler) as server:
+        print("Listening on", server.server_address)
+        server.serve_forever()
+
+run_server("unix:@test")
support/testing/tests/package/test_python_varlink/test_python_varlink.py new file +31 -0
new file mode 100644
index 0000000000..0979f22847
@@ -0,0 +1,31 @@
+import os
+import time
+
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonPy3Varlink(TestPythonPackageBase):
+    __test__ = True
+    config = TestPythonPackageBase.config + \
+        """
+        BR2_PACKAGE_PYTHON3=y
+        BR2_PACKAGE_PYTHON_VARLINK=y
+        """
+    sample_scripts = ["tests/package/test_python_varlink/sample_python_varlink.py",
+                      "tests/package/test_python_varlink/org.example.test.varlink"]
+
+    def test_run(self):
+        self.login()
+        self.check_sample_scripts_exist()
+        # we need to supress any output here as otherwise the commnd output parsing
+        # gets confused for the second command
+        cmd = "%s %s  > /dev/null 2>&1 &" % (self.interpreter, os.path.basename(self.sample_scripts[0]))
+
+        _, exit_code = self.emulator.run(cmd, timeout=self.timeout)
+
+        varlink_cli_call = "-m varlink.cli call 'unix:@test/org.example.test.Ping' '{\"ping\": \"hello\"}'"
+        unprettyprint = "| python -m json.tool --compact"
+        cmd = "%s %s %s" % (self.interpreter, varlink_cli_call, unprettyprint)
+        output, exit_code = self.emulator.run(cmd, timeout=self.timeout)
+        self.assertEqual(exit_code, 0)
+        self.assertEqual(output[0], '{"pong":"hello"}')
Signature · 6 lines
2.52.0

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

Re: [Buildroot] [PATCH 2/2] support/testing: python-varlink: new runtime test

Quoted 3 lines · On Mon, 24 Nov 2025 15:05:16 +0100 Marcus Hoffmann <[email protected]> wrote:

Add new runtime test for python-varlink. Add this in a subdirectory, so the separate example interface file (which should be named in reverse DNS notation) does not sit loosly in the general package test dir.

I changed this to not have the test in a subdir. I kept the interface file and sample script in a subdir, but not the test itself.

The reason: consistency with other tests, that have the same organization, the test is in support/testing/tests/packages/, and there is a subdir for the artifacts that are needed for the test to run.

Applied with this small change. Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw
In reply to Marcus Hoffmann via buildroot
Quoted 8 lines · On Mon, 24 Nov 2025 15:05:15 +0100 Marcus Hoffmann via buildroot…

There are currently problems in updating the pypi.org release[1], so we pull the package from the github generated tarball instead. This in turn then requires manually setting the version for setuptools_scm in the environment.

[1] https://github.com/varlink/python/issues/81

Quoted 10 lines
---
 DEVELOPERS                                 |  1 +
 package/Config.in                          |  1 +
 package/python-varlink/Config.in           |  6 ++++++
 package/python-varlink/python-varlink.hash |  3 +++
 package/python-varlink/python-varlink.mk   | 15 +++++++++++++++
 5 files changed, 26 insertions(+)
 create mode 100644 package/python-varlink/Config.in
 create mode 100644 package/python-varlink/python-varlink.hash
 create mode 100644 package/python-varlink/python-varlink.mk

Applied to master, thanks.

Thomas

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot