Skip to content

Commit 60455cb

Browse files
committed
python-pyusb: add version 1.3.1
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 <alex@shruggie.ro>
1 parent c3fc621 commit 60455cb

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed

lang/python/python-pyusb/Makefile

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#
2+
# This is free software, licensed under the GNU General Public License v2.
3+
# See /LICENSE for more information.
4+
#
5+
6+
include $(TOPDIR)/rules.mk
7+
8+
PKG_NAME:=python-pyusb
9+
PKG_VERSION:=1.3.1
10+
PKG_RELEASE:=1
11+
12+
PYPI_NAME:=pyusb
13+
PKG_HASH:=3af070b607467c1c164f49d5b0caabe8ac78dbed9298d703a8dbf9df4052d17e
14+
15+
PKG_MAINTAINER:=Alexandru Ardelean <ardeleanalex@gmail.com>
16+
PKG_LICENSE:=BSD-3-Clause
17+
PKG_LICENSE_FILES:=LICENSE
18+
19+
PKG_BUILD_DEPENDS:=python-setuptools/host python-setuptools-scm/host
20+
21+
include ../pypi.mk
22+
include $(INCLUDE_DIR)/package.mk
23+
include ../python3-package.mk
24+
25+
define Package/python3-pyusb
26+
SECTION:=lang
27+
CATEGORY:=Languages
28+
SUBMENU:=Python
29+
TITLE:=Easy USB access for Python
30+
URL:=https://pyusb.github.io/pyusb
31+
DEPENDS:=+python3-light +python3-logging +libusb-1.0
32+
endef
33+
34+
define Package/python3-pyusb/description
35+
PyUSB provides easy USB access for Python. It runs on any platform
36+
supported by libusb and offers a high-level, Pythonic interface to
37+
USB devices.
38+
endef
39+
40+
$(eval $(call Py3Package,python3-pyusb))
41+
$(eval $(call BuildPackage,python3-pyusb))
42+
$(eval $(call BuildPackage,python3-pyusb-src))

lang/python/python-pyusb/test.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/sh
2+
3+
[ "$1" = python3-pyusb ] || exit 0
4+
5+
python3 - << 'EOF'
6+
import usb
7+
import usb.core
8+
import usb.util
9+
import usb.control
10+
import usb.backend.libusb1
11+
12+
# version string is a non-empty string
13+
assert isinstance(usb.__version__, str) and len(usb.__version__) > 0, 'bad version: ' + repr(usb.__version__)
14+
15+
# exception classes are proper Exception subclasses
16+
assert issubclass(usb.core.USBError, Exception)
17+
assert issubclass(usb.core.NoBackendError, usb.core.USBError)
18+
19+
# find() with no devices returns an empty list, must not raise
20+
devices = list(usb.core.find(find_all=True))
21+
assert isinstance(devices, list), 'find() did not return a list'
22+
23+
# util.find_descriptor is callable
24+
assert callable(usb.util.find_descriptor)
25+
EOF

0 commit comments

Comments
 (0)