python-pyusb: add version 1.3.1
authorAlexandru Ardelean <redacted>
Sun, 12 Apr 2026 12:58:42 +0000 (15:58 +0300)
committerAlexandru Ardelean <redacted>
Thu, 16 Apr 2026 16:00:53 +0000 (19:00 +0300)
PyUSB provides easy USB access in Python via libusb backend:
- Pure Python implementation working with libusb-1.0/0.1.x
- Requires Python >= 3.9
- High-level Pythonic interface to USB devices
- Supports bulk/interrupt/control/isochronous transfers
- Homepage: https://pyusb.github.io/pyusb

Signed-off-by: Alexandru Ardelean <redacted>
lang/python/python-pyusb/Makefile [new file with mode: 0644]
lang/python/python-pyusb/test.sh [new file with mode: 0755]

diff --git a/lang/python/python-pyusb/Makefile b/lang/python/python-pyusb/Makefile
new file mode 100644 (file)
index 0000000..53056f9
--- /dev/null
@@ -0,0 +1,45 @@
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=python-pyusb
+PKG_VERSION:=1.3.1
+PKG_RELEASE:=1
+
+PYPI_NAME:=pyusb
+PKG_HASH:=3af070b607467c1c164f49d5b0caabe8ac78dbed9298d703a8dbf9df4052d17e
+
+PKG_MAINTAINER:=Alexandru Ardelean <ardeleanalex@gmail.com>
+PKG_LICENSE:=BSD-3-Clause
+PKG_LICENSE_FILES:=LICENSE
+
+PKG_BUILD_DEPENDS:=python-setuptools/host python-setuptools-scm/host
+
+include ../pypi.mk
+include $(INCLUDE_DIR)/package.mk
+include ../python3-package.mk
+
+define Package/python3-pyusb
+  SECTION:=lang
+  CATEGORY:=Languages
+  SUBMENU:=Python
+  TITLE:=Easy USB access for Python
+  URL:=https://pyusb.github.io/pyusb
+  DEPENDS:=+python3-light \
+           +python3-ctypes \
+           +python3-logging \
+           +libusb-1.0
+endef
+
+define Package/python3-pyusb/description
+PyUSB provides easy USB access for Python. It runs on any platform
+supported by libusb and offers a high-level, Pythonic interface to
+USB devices.
+endef
+
+$(eval $(call Py3Package,python3-pyusb))
+$(eval $(call BuildPackage,python3-pyusb))
+$(eval $(call BuildPackage,python3-pyusb-src))
diff --git a/lang/python/python-pyusb/test.sh b/lang/python/python-pyusb/test.sh
new file mode 100755 (executable)
index 0000000..5da850d
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+[ "$1" = python3-pyusb ] || exit 0
+
+python3 - << 'EOF'
+import usb
+import usb.core
+import usb.util
+import usb.control
+import usb.backend.libusb1
+
+# version string is a non-empty string
+assert isinstance(usb.__version__, str) and len(usb.__version__) > 0,     'bad version: ' + repr(usb.__version__)
+
+# exception classes are proper Exception subclasses
+assert issubclass(usb.core.USBError, Exception)
+assert issubclass(usb.core.NoBackendError, Exception)
+
+# find() returns an empty list, or raises NoBackendError when no backend is available
+try:
+    devices = list(usb.core.find(find_all=True))
+    assert isinstance(devices, list), 'find() did not return a list'
+except usb.core.NoBackendError:
+    pass  # acceptable: no USB backend available in test environment
+
+# util.find_descriptor is callable
+assert callable(usb.util.find_descriptor)
+EOF
\ No newline at end of file
git clone https://git.99rst.org/PROJECT