mirror of
https://github.com/openwrt/packages.git
synced 2026-06-14 01:27:15 +08:00
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>
This commit is contained in:
committed by
Alexandru Ardelean
parent
1c973fff92
commit
0b4980efe0
28
lang/python/python-pyusb/test.sh
Executable file
28
lang/python/python-pyusb/test.sh
Executable file
@@ -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
|
||||
Reference in New Issue
Block a user