Skip to contentSkip to conversation

package/python-hid: new package

PATCH Applied Peter Korsgaard 2 participants 5 messages Apr 27, 2024 – May 11, 2024

lore
Share & tools
lore
#0 lore raw

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

A python wrapper for the hidapi library. Hidapi has fairly complicated dependencies, so use a select rather than a depends on.

---
 DEVELOPERS                         |  1 +
 package/Config.in                  |  1 +
 package/python-hid/Config.in       |  7 +++++++
 package/python-hid/python-hid.hash |  5 +++++
 package/python-hid/python-hid.mk   | 14 ++++++++++++++
 5 files changed, 28 insertions(+)
 create mode 100644 package/python-hid/Config.in
 create mode 100644 package/python-hid/python-hid.hash
 create mode 100644 package/python-hid/python-hid.mk
DEVELOPERS +1 -0
index 399b2931ff..29c32f0a11 100644
@@ -2480,6 +2480,7 @@ F:	package/python-cached-property/
 F:	package/python-docker/
 F:	package/python-dockerpty/
 F:	package/python-docker-pycreds/
+F:	package/python-hid/
 F:	package/python-psutil/
 F:	package/python-request-id/
 F:	package/python-semver/
package/Config.in +1 -0
index 1935077f0f..d4d951d903 100644
@@ -1121,6 +1121,7 @@ menu "External python modules"
 	source "package/python-gunicorn/Config.in"
 	source "package/python-h11/Config.in"
 	source "package/python-h2/Config.in"
+	source "package/python-hid/Config.in"
 	source "package/python-hiredis/Config.in"
 	source "package/python-hkdf/Config.in"
 	source "package/python-hpack/Config.in"
package/python-hid/Config.in new file +7 -0
new file mode 100644
index 0000000000..78af383e65
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_PYTHON_HID
+	bool "python-hid"
+	depends on BR2_PACKAGE_HIDAPI # runtime
+	help
+	  ctypes bindings for hidapi.
+
+	  https://github.com/apmorton/pyhidapi
package/python-hid/python-hid.hash new file +5 -0
new file mode 100644
index 0000000000..d03757771b
@@ -0,0 +1,5 @@
+# md5, sha256 from https://pypi.org/pypi/hid/json
+md5  1954df0dce4e15afd89197e898039e92  hid-1.0.6.tar.gz
+sha256  48d764d7ae9746ba123b96dbf457893ca80268b7791c4b1d2e051310eeb83860  hid-1.0.6.tar.gz
+# Locally computed sha256 checksums
+sha256  5524b425acacdfedeca3f959980f0cd38b00176ebbb292e4a96c520d6074353d  LICENSE
package/python-hid/python-hid.mk new file +14 -0
new file mode 100644
index 0000000000..2f65bd1412
@@ -0,0 +1,14 @@
+################################################################################
+#
+# python-hid
+#
+################################################################################
+
+PYTHON_HID_VERSION = 1.0.6
+PYTHON_HID_SOURCE = hid-$(PYTHON_HID_VERSION).tar.gz
+PYTHON_HID_SITE = https://files.pythonhosted.org/packages/50/b8/5f470948262b6cdda8e1b2382b19f67c57eacda1e07a14322807b911e0ce
+PYTHON_HID_SETUP_TYPE = setuptools
+PYTHON_HID_LICENSE = MIT
+PYTHON_HID_LICENSE_FILES = LICENSE
+
+$(eval $(python-package))
Signature · 6 lines
2.39.2

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

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

---
 DEVELOPERS                                         |  1 +
 support/testing/tests/package/sample_python_hid.py |  3 +++
 support/testing/tests/package/test_python_hid.py   | 13 +++++++++++++
 3 files changed, 17 insertions(+)
 create mode 100644 support/testing/tests/package/sample_python_hid.py
 create mode 100644 support/testing/tests/package/test_python_hid.py
DEVELOPERS +1 -0
index 29c32f0a11..f426aa376e 100644
@@ -2494,6 +2494,7 @@ F:	package/triggerhappy/
 F:	package/wireguard-linux-compat/
 F:	package/wireguard-tools/
 F:	support/testing/tests/package/test_docker_compose.py
+F:	support/testing/tests/package/test_python_hid.py
 
 N:	Peter Seiderer <[email protected]>
 F:	package/dotconf/
support/testing/tests/package/sample_python_hid.py new file +3 -0
new file mode 100644
index 0000000000..a581d7b7cb
@@ -0,0 +1,3 @@
+import hid
+
+hid.enumerate()
support/testing/tests/package/test_python_hid.py new file +13 -0
new file mode 100644
index 0000000000..b7a280b766
@@ -0,0 +1,13 @@
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonHid(TestPythonPackageBase):
+    __test__ = True
+    config = TestPythonPackageBase.config + \
+        """
+        BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
+        BR2_PACKAGE_PYTHON3=y
+        BR2_PACKAGE_PYTHON_HID=y
+        BR2_PACKAGE_HIDAPI=y
+        """
+    sample_scripts = ["tests/package/sample_python_hid.py"]
Signature · 6 lines
2.39.2

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

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

Quoted 8 lines · On Sat, 27 Apr 2024 16:09:40 +0200 Peter Korsgaard <[email protected]> wrote:
---
 DEVELOPERS                                         |  1 +
 support/testing/tests/package/sample_python_hid.py |  3 +++
 support/testing/tests/package/test_python_hid.py   | 13 +++++++++++++
 3 files changed, 17 insertions(+)
 create mode 100644 support/testing/tests/package/sample_python_hid.py
 create mode 100644 support/testing/tests/package/test_python_hid.py

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
#3 lore raw
In reply to Peter Korsgaard
Quoted 2 lines · On Sat, 27 Apr 2024 16:09:39 +0200 Peter Korsgaard <[email protected]> wrote:

A python wrapper for the hidapi library. Hidapi has fairly complicated dependencies, so use a select rather than a depends on.

You actually did the opposite :-)

But in fact, there were only 3 depends, so not that much to propagate, so I stuck to our normal way: a select BR2_PACKAGE_HIDAPI + propagation of the depends on. Otherwise people will start using that as a counter example and use "depends on" where "select" should be used.

Applied with this change. 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
#4 lore raw
Quoted 6 lines · Thomas Petazzoni
Quoted 2 lines · On Sat, 27 Apr 2024 16:09:39 +0200 Peter Korsgaard <[email protected]> wrote:

A python wrapper for the hidapi library. Hidapi has fairly complicated dependencies, so use a select rather than a depends on.

Quoted 8 lines

You actually did the opposite :-)

But in fact, there were only 3 depends, so not that much to propagate, so I stuck to our normal way: a select BR2_PACKAGE_HIDAPI + propagation of the depends on. Otherwise people will start using that as a counter example and use "depends on" where "select" should be used.

Applied with this change. Thanks!

Heh, indeed - Sorry for the mess, and thanks for fixing it up. I see that the unit test still has an explicit BR2_PACKAGE_HIDAPI, but that can now be dropped.

I'll send a patch for that.

Signature · 6 lines
Bye, Peter Korsgaard

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