vpelletier / python-libusb1

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

2.0.1 fails to build with Python 3.11.0a2 #81

Closed hegjon closed 2 years ago

hegjon commented 2 years ago

Python 3.11 is planned to be included in Fedora 37. To make that update smoother, we're building Fedora packages with a pre-releases of Python 3.11.

Stack trace:

CFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection'
LDFLAGS='-Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 '
/usr/bin/python3 setup.py build '--executable=/usr/bin/python3 -s'
Traceback (most recent call last):
  File "/builddir/build/BUILD/libusb1-2.0.1/setup.py", line 159, in <module>
    version=versioneer.get_version(),
            ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/libusb1-2.0.1/versioneer.py", line 1483, in get_version
    return get_versions()["version"]
           ^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/libusb1-2.0.1/versioneer.py", line 1415, in get_versions
    cfg = get_config_from_root(root)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/libusb1-2.0.1/versioneer.py", line 344, in get_config_from_root
    parser = configparser.SafeConfigParser()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'configparser' has no attribute 'SafeConfigParser'. Did you mean: 'RawConfigParser'?
error: Bad exit status from /var/tmp/rpm-tmp.9TIXxZ (%build)
    Bad exit status from /var/tmp/rpm-tmp.9TIXxZ (%build)
hroncok commented 2 years ago

Updating bundled versioneer should fix this.

vpelletier commented 2 years ago

I believe 032073e2bdd4634d6d55fb94a6f41bb5e5b15252 should fix this, but I do not have available 3.11 to test. Could you check if it does fix the issue ?

hugovk commented 2 years ago

Yes, or at least I can install fine with Python 3.11:

2.0.1

$ python3.11 -m pip install .
Processing /private/tmp/python-libusb1
  Preparing metadata (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /Users/hugo/.pyenv/versions/3.11-dev/bin/python3.11 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/tmp/python-libusb1/setup.py'"'"'; __file__='"'"'/private/tmp/python-libusb1/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/kt/j77sf4_n6fnbx6pg199rbx700000gn/T/pip-pip-egg-info-l6pmsztc
       cwd: /private/tmp/python-libusb1/
  Complete output (15 lines):
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/private/tmp/python-libusb1/setup.py", line 159, in <module>
      version=versioneer.get_version(),
              ^^^^^^^^^^^^^^^^^^^^^^^^
    File "/private/tmp/python-libusb1/versioneer.py", line 1483, in get_version
      return get_versions()["version"]
             ^^^^^^^^^^^^^^
    File "/private/tmp/python-libusb1/versioneer.py", line 1415, in get_versions
      cfg = get_config_from_root(root)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/private/tmp/python-libusb1/versioneer.py", line 344, in get_config_from_root
      parser = configparser.SafeConfigParser()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  AttributeError: module 'configparser' has no attribute 'SafeConfigParser'. Did you mean: 'RawConfigParser'?
  ----------------------------------------
WARNING: Discarding file:///private/tmp/python-libusb1. Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

master

$ python3.11 -m pip install .
Processing /private/tmp/python-libusb1
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: libusb1
  Building wheel for libusb1 (setup.py) ... done
  Created wheel for libusb1: filename=libusb1-2.0.1+3.g86ad8ab-py3-none-any.whl size=61903 sha256=ccb78c022cd801e180a88cd50385e2d5ccca34a8daa08ab2a391ce393d3e3bc2
  Stored in directory: /Users/hugo/Library/Caches/pip/wheels/67/81/e9/f1f078d6b87e62d9d20214dc8ef58dc9527fdc0e55d7afa81b
Successfully built libusb1
Installing collected packages: libusb1
  Attempting uninstall: libusb1
    Found existing installation: libusb1 2.0.1+3.g86ad8ab
    Uninstalling libusb1-2.0.1+3.g86ad8ab:
      Successfully uninstalled libusb1-2.0.1+3.g86ad8ab
Successfully installed libusb1-2.0.1+3.g86ad8ab

note

Versioneer 0.21 is compatible with Python 3.6+, so you may need to drop EOL 3.4-3.5 (3.6 is also EOL):

cycle latest release eol
3.10 3.10.1 2021-10-04 2026-10-04
3.9 3.9.9 2020-10-05 2025-10-05
3.8 3.8.12 2019-10-14 2024-10-14
3.7 3.7.12 2018-06-27 2023-06-27
3.6 3.6.15 2016-12-23 2021-12-23
3.5 3.5.10 2015-09-30 2020-09-13
3.4 3.4.10 2014-03-16 2019-03-18

But 3.4-3.5 are little used. Here's the pip installs for libusb1 from PyPI for December 2021:

category percent downloads
3.6 67.43% 146,358
3.8 11.49% 24,936
3.7 8.70% 18,877
3.9 4.81% 10,430
null 4.34% 9,414
2.7 2.38% 5,164
3.10 0.80% 1,738
3.5 0.05% 98
3.4 0.01% 18
3.11 0.00% 4
Total 217,037

Date range: 2021-12-01 - 2021-12-31

Source: pip install -U pypistats && pypistats python_minor libusb1 --last-month

vpelletier commented 2 years ago

Thanks for the test and heads-up about version usage & compatibility. I did not know pypi was still collecting stats ever since these were removed from the webpage.

I just started working on releasing the next version, but found that libusb 1.0.25 was just released, and that my unit tests are making it unhappy (segfault when freeing a transfer). I reported the issue to libusb.

vpelletier commented 2 years ago

I fixed the test issues with 1.0.25, and released python-libusb1 3.0.0 (major bump because of the drop of <py3.6).

I believe this resolves this bug report, thanks !