vpelletier / python-libusb1

Python ctype-based wrapper around libusb1
GNU Lesser General Public License v2.1
168 stars 65 forks source link

Broken build on Linux #65

Closed xHire closed 3 years ago

xHire commented 3 years ago

Recent addition of wheel as a setup dependency broke the installation on my Gentoo Linux system using this ebuild I wrote.

Download error on https://pypi.org/simple/wheel/: [Errno -3] Temporary failure in name resolution -- Some packages may not be found!
Couldn't find index page for 'wheel' (maybe misspelled?)
Download error on https://pypi.org/simple/: [Errno -3] Temporary failure in name resolution -- Some packages may not be found!
No local packages or working download links found for wheel
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/setuptools/installer.py", line 60, in fetch_build_egg
    pkg_resources.get_distribution('pip')
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 465, in get_distribution
    dist = get_provider(dist)
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 341, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 884, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 770, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pip' distribution was not found and is required by the application

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "setup.py", line 177, in <module>
    test_suite='usb1.testUSB1',
  File "/usr/lib/python3.7/site-packages/setuptools/__init__.py", line 152, in setup
    _install_setup_requires(attrs)
  File "/usr/lib/python3.7/site-packages/setuptools/__init__.py", line 147, in _install_setup_requires
    dist.fetch_build_eggs(dist.setup_requires)
  File "/usr/lib/python3.7/site-packages/setuptools/dist.py", line 676, in fetch_build_eggs
    replace_conflicting=True,
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 766, in resolve
    replace_conflicting=replace_conflicting
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1049, in best_match
    return self.obtain(req, installer)
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1061, in obtain
    return installer(requirement)
  File "/usr/lib/python3.7/site-packages/setuptools/dist.py", line 732, in fetch_build_egg
    return fetch_build_egg(self, req)
  File "/usr/lib/python3.7/site-packages/setuptools/installer.py", line 68, in fetch_build_egg
    return _legacy_fetch_build_egg(dist, req)
  File "/usr/lib/python3.7/site-packages/setuptools/installer.py", line 51, in _legacy_fetch_build_egg
    return cmd.easy_install(req)
  File "/usr/lib/python3.7/site-packages/setuptools/command/easy_install.py", line 663, in easy_install
    raise DistutilsError(msg)
distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('wheel')

(Yes, the build process is sandboxed.)

The following patch fixes the problem: https://github.com/xHire/overlay/blob/master/dev-python/libusb1/files/libusb1-1.9.1-no_wheel_dependency.patch

In my opinion, the source tarball should be platform-independent. Unless I’m mistaken, wheel is only needed for Windows builds. It isn’t even packaged for Gentoo Linux. And python-libusb1 does build totally fine without it.

vpelletier commented 3 years ago

Hello,

In my opinion, the source tarball should be platform-independent.

This was my intention, yes.

The following patch fixes the problem:

Would the following work for you ? This fixes my release process (setup.sh), which needs the bdist_wheel command, which does not exist when wheel is removed from setup_requires (...oh the fun of python packaging).

diff --git a/setup.py b/setup.py
index bf6a3bf..3375a20 100644
--- a/setup.py
+++ b/setup.py
@@ -171,9 +171,11 @@ setup(
         'Topic :: Software Development :: Libraries',
         'Topic :: System :: Hardware :: Hardware Drivers',
     ],
-    setup_requires=[
-        'wheel',
-    ],
+    setup_requires=(
+        ['wheel']
+        if 'bdist_wheel' in sys.argv else
+        []
+    ),
     use_2to3=True,
     test_suite='usb1.testUSB1',
 )
xHire commented 3 years ago

Hello! I’ve just tested your patch and it builds fine too. :·) Thank you!

vpelletier commented 3 years ago

Thanks, pushed in master. I intend to release this fix as 1.9.2 soon.

vpelletier commented 3 years ago

Released.