New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide binary wheels with libusb dll for Windows #33
Comments
libusb is licensed under the GPL (LGPL v2.1 actually), so there is no restrictions on redistribution. I'm not very tempted about bundling it with python-libusb1, but not for licence reasons:
|
Thanks for clarifying. I could help with setting up automated builds using appveyor. This would solve your second point and maybe the first one too, since it would automatically pull in a new version with each release of python-libusb1. I didn't know about the need to use special drivers though. I didn't have to install any drivers to use python-trezor (which uses this library) but I assume that's not true for all devices. |
While I am not familiar with python-trezor, I see it supports several ways to access the device, including HID. HID is much more convenient to use on windows than "raw" USB, precisely because it does not require a specific driver (which in turn prompted many device makers to use the HID class, I believe, for example I have an NFC-ish dongle which uses it). Maybe this is what is used in your setup ? python-libusb1 loads the library and pulls all entry points when the usb1 module is imported, so it would complain if it is missing even if it were not actually used. Or it could be used to list connected devices, find nothing (because no supported driver would be present) and containing app could carry on enumerating with other mechanisms. I believe libusb development team recommends using HID-specific libraries rather than implementing boiler-plate HID stuff over libusb on each use. Then again, I see they are referring to WebUSB, which I do not know and which apparently handles the driver part. Looks like I'm lagging behind in libusb-related knowledge on windows. |
@vpelletier Would you be open to reconsidering this? I understand the reluctance, but I'd like to address all three points here:
To add to the last point, I believe that even if we disregard WinUSB, packaging the libusb shared library would significantly improve the Windows experience. Please consider this from my perspective of an application developer trying to make installation process as painless as possible:
Packaging the libusb1 shared library would eliminate the second step. If there is working pip, there is working libusb, that's it. What remains is, at worst, three clicks in Zadig, that's if the device isn't using WinUSB, and only until someone packages Let me know if you'd like me to send a PR implementing this—it would be only a few lines of code. Now that I've shipped YoWASP, python-libusb1 is the last thing that stops Glasgow from having a Windows installation procedure that consists of a single |
Thanks for the very good points and insight into the libusb windows install process. Some not-too-structured thoughts:
I'm not asking you to provide implementation or answer to each of these thoughts, but rather your opinion on whether these make sense.
Yes please. I do not have enough experience with python wheels, so every bit helps. And again, do not feel required to implement the points I just mentioned. |
I lean towards always loading the bundled
In case someone really does want to use system libusb for some reason, it is easy enough to do:
Indeed. This isn't really viable anyway. It's not completely technically impossible to build such an universal wheel (on Linux at least), but that approach has too many flaws to seriously consider shipping it.
I've heard that these days people mostly use
libusb1 is released on GitHub, so each binary archive inherently has a corresponding source archive produced by GitHub. I'd personally expect that a link to the official release page would be enough (given that there are cryptographic hashes for both sources and binaries proving that you indeed are distributing the upstream version of libusb1).
Yup, sounds like what I'd do.
I use a 2 step build process:
|
After reading a bit more about the "DLL hell" and what is done in other bdist wheels, ideally the DLL should have a unique name to force windows to actually load the DLL even if the same process already loaded an homonym. I guess this is not really mandatory, as it should be unusual to mix multiple libusb dll in the same process, but this is something which should ideally be taken care of. I'm also wondering how I should package 32 and 64bits versions: build-time copy of the right version to a common name, or run-time detection and loading of the correct version ? So fer I have not found something which would handle these for me, but please let me know if this is just my google-fu being weak - I've already doubled my setup.py size and it is not working yet. |
If I recall correctly, if you pass a full path to
I'd say two different wheels, though one could argue for runtime detection too. |
I think this would be fairly straightforward to me--once I find time I'll try to get something working. But that might take a while, unfortunately. |
Quick update: I expect to be able to implement this soon. |
Commits applied, and released as 1.8.1 . |
Providing a binary wheel with
libusb-1.0.dll
would make the installation as simple aspip install libusb1
.Are there any licensing issues that prevent you from shipping a copy of that library?
The text was updated successfully, but these errors were encountered: