[build] Fix DFU on recent Python versions and drop Python 2

This commit is contained in:
Yaya-Cout
2024-01-14 12:13:24 +01:00
parent 5b87721f6e
commit f7a298aa0b

View File

@@ -79,7 +79,7 @@ __DFU_INTERFACE = 0
# Python 3 deprecated getargspec in favour of getfullargspec, but
# Python 2 doesn't have the latter, so detect which one to use
import inspect
getargspec = getattr(inspect, 'getfullargspec', inspect.getargspec)
getargspec = getattr(inspect, 'getfullargspec', inspect.getfullargspec)
if 'length' in getargspec(usb.util.get_string).args:
# PyUSB 1.0.0.b1 has the length argument