push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -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

View File

@@ -0,0 +1,47 @@
{
lib,
stdenv,
buildPythonPackage,
fetchFromGitHub,
replaceVars,
setuptools,
libusb1,
pytestCheckHook,
}:
buildPythonPackage rec {
pname = "libusb1";
version = "3.3.1";
pyproject = true;
src = fetchFromGitHub {
owner = "vpelletier";
repo = "python-libusb1";
tag = version;
hash = "sha256-nytxew6KogpEpSnRtmY0UNH+07x0k0XLZ/MRC9NSpDg=";
};
patches = [
(replaceVars ./ctypes.patch {
libusb = "${lib.getLib libusb1}/lib/libusb-1.0${stdenv.hostPlatform.extensions.sharedLibrary}";
})
];
build-system = [ setuptools ];
buildInputs = [ libusb1 ];
nativeCheckInputs = [ pytestCheckHook ];
enabledTestPaths = [ "usb1/testUSB1.py" ];
meta = with lib; {
homepage = "https://github.com/vpelletier/python-libusb1";
description = "Python ctype-based wrapper around libusb1";
license = licenses.lgpl2Plus;
maintainers = with maintainers; [
prusnak
rnhmjoj
];
};
}