python313Packages.libusb1: 3.1.0 -> 3.2.0 (#371018)
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
diff --git a/usb1/_libusb1.py b/usb1/_libusb1.py
|
||||
index 42b01e9..36f2d16 100644
|
||||
--- a/usb1/_libusb1.py
|
||||
+++ b/usb1/_libusb1.py
|
||||
@@ -172,64 +172,13 @@ else:
|
||||
LIBUSB_CALL_FUNCTYPE = CFUNCTYPE
|
||||
|
||||
def __getLibrary():
|
||||
- my_dir = os.path.dirname(__file__)
|
||||
system = platform.system()
|
||||
- # If this is a binary wheel, try to use an integrated libusb first.
|
||||
- # To use the libusb from the Python installation or the OS, install
|
||||
- # from sdist:
|
||||
- # > pip install --no-binary :all: libusb1
|
||||
if system == 'Windows':
|
||||
dll_loader = ctypes.WinDLL
|
||||
- libusb_list = [
|
||||
- os.path.join(my_dir, 'libusb-1.0.dll'),
|
||||
- 'libusb-1.0.dll',
|
||||
- ]
|
||||
- find_library = None
|
||||
else:
|
||||
dll_loader = CDLL
|
||||
- if system == 'Darwin':
|
||||
- libusb_list = [
|
||||
- os.path.join(my_dir, 'libusb-1.0.dylib'),
|
||||
- 'libusb-1.0.dylib',
|
||||
- # macport standard path
|
||||
- '/opt/local/lib/libusb-1.0.dylib',
|
||||
- # fink standard path
|
||||
- '/sw/lib/libusb-1.0.dylib',
|
||||
- # homebrew standard path for symlink (Apple M1 Silicon)
|
||||
- '/opt/homebrew/opt/libusb/lib/libusb-1.0.dylib',
|
||||
- ]
|
||||
- find_library = None
|
||||
- else:
|
||||
- # .so.0 should be the optimal suffix
|
||||
- # .so is for BBB, especially if libusb-1.0.so was bundled in some
|
||||
- # uses of this module.
|
||||
- libusb_list = [
|
||||
- os.path.join(my_dir, 'libusb-1.0.so.0'),
|
||||
- os.path.join(my_dir, 'libusb-1.0.so'),
|
||||
- 'libusb-1.0.so.0',
|
||||
- 'libusb-1.0.so',
|
||||
- ]
|
||||
- find_library = (
|
||||
- # libusb.so.2 on FreeBSD: load('libusb.so') would work fine, but...
|
||||
- # libusb.so.2debian on Debian GNU/kFreeBSD: here it wouldn't work.
|
||||
- 'usb'
|
||||
- if 'FreeBSD' in system else
|
||||
- 'usb-1.0'
|
||||
- )
|
||||
- for filename in libusb_list:
|
||||
- try:
|
||||
- return dll_loader(filename, use_errno=True, use_last_error=True)
|
||||
- except OSError:
|
||||
- pass
|
||||
- if find_library is not None:
|
||||
- filename = ctypes.util.find_library(find_library)
|
||||
- if filename is not None:
|
||||
- return dll_loader(filename, use_errno=True, use_last_error=True)
|
||||
- raise OSError(
|
||||
- errno.ENOENT,
|
||||
- 'cannot find a suitable libusb-1.0',
|
||||
- libusb_list,
|
||||
- )
|
||||
+
|
||||
+ return dll_loader("@libusb@", use_errno=True, use_last_error=True)
|
||||
|
||||
__load_lock = Lock()
|
||||
__loaded = False
|
||||
@@ -2,26 +2,33 @@
|
||||
lib,
|
||||
stdenv,
|
||||
buildPythonPackage,
|
||||
fetchPypi,
|
||||
fetchFromGitHub,
|
||||
substituteAll,
|
||||
setuptools,
|
||||
libusb1,
|
||||
pytestCheckHook,
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "libusb1";
|
||||
version = "3.1.0";
|
||||
format = "setuptools";
|
||||
version = "3.2.0";
|
||||
pyproject = true;
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "4ee9b0a55f8bd0b3ea7017ae919a6c1f439af742c4a4b04543c5fd7af89b828c";
|
||||
src = fetchFromGitHub {
|
||||
owner = "vpelletier";
|
||||
repo = "python-libusb1";
|
||||
tag = version;
|
||||
hash = "sha256-D2VMqrq1MQa6gp8vxDiLRAqTDyRGK3qVKo6YMmo5Zrg=";
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace usb1/_libusb1.py --replace \
|
||||
"ctypes.util.find_library(base_name)" \
|
||||
"'${libusb1}/lib/libusb-1.0${stdenv.hostPlatform.extensions.sharedLibrary}'"
|
||||
'';
|
||||
patches = [
|
||||
(substituteAll {
|
||||
src = ./ctypes.patch;
|
||||
libusb = "${lib.getLib libusb1}/lib/libusb-1.0${stdenv.hostPlatform.extensions.sharedLibrary}";
|
||||
})
|
||||
];
|
||||
|
||||
build-system = [ setuptools ];
|
||||
|
||||
buildInputs = [ libusb1 ];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user