Bug 2026946

Summary: python-libusb1 fails to build with Python 3.11: AttributeError: module 'configparser' has no attribute 'SafeConfigParser'.
Product: [Fedora] Fedora Reporter: Tomáš Hrnčiar <thrnciar>
Component: python-libusb1Assignee: Jonny Heggheim <hegjon>
Status: CLOSED DEFERRED QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 36CC: hegjon, hugovk+redhatbugzilla, mhroncok, thrnciar
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-02-10 10:55:10 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2016048    

Description Tomáš Hrnčiar 2021-11-26 15:10:20 UTC
python-libusb1 fails to build with Python 3.11.0a2.

Traceback (most recent call last):
  File "/builddir/build/BUILD/libusb1-1.9.2/setup.py", line 167, in <module>
    version=versioneer.get_version(),
            ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/libusb1-1.9.2/versioneer.py", line 1483, in get_version
    return get_versions()["version"]
           ^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/libusb1-1.9.2/versioneer.py", line 1415, in get_versions
    cfg = get_config_from_root(root)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/libusb1-1.9.2/versioneer.py", line 344, in get_config_from_root
    parser = configparser.SafeConfigParser()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'configparser' has no attribute 'SafeConfigParser'. Did you mean: 'RawConfigParser'?

Removed from the configparser module: the SafeConfigParser class, the filename
property of the ParsingError class, the readfp() method of the ConfigParser
class, deprecated since Python 3.2. (Contributed by Hugo van Kemenade in
bpo-45173.)

Removed from the configparser module: the SafeConfigParser class, the filename property of the ParsingError class, the readfp() method of the ConfigParser class, deprecated since Python 3.2. (Contributed by Hugo van Kemenade in bpo-45173.)

https://bugs.python.org/issue45173
https://docs.python.org/3.11/whatsnew/3.11.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.11/fedora-rawhide-x86_64/02990043-python-libusb1/

For all our attempts to build python-libusb1 with Python 3.11, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/package/python-libusb1/

Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.11:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/

Let us know here if you have any questions.

Python 3.11 is planned to be included in Fedora 37. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.11.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon.
We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Jonny Heggheim 2021-11-26 23:12:16 UTC
Pushed the latest release to rawhide and started a build:

Task info: https://koji.fedoraproject.org/koji/taskinfo?taskID=79302378

Could you see if upstream have fixed the error in the last release?

Comment 2 Jonny Heggheim 2021-11-30 10:05:04 UTC
Did try to build locally, got the same error

+ /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)

Comment 3 Jonny Heggheim 2021-11-30 10:25:22 UTC
Reported to upstream https://github.com/vpelletier/python-libusb1/issues/81

Comment 4 Hugo van Kemenade 2022-01-13 09:27:01 UTC
Fixed upstream: https://github.com/vpelletier/python-libusb1/issues/81#issuecomment-983594180

Comment 5 Jonny Heggheim 2022-01-13 16:23:32 UTC
(In reply to Hugo van Kemenade from comment #4)
> Fixed upstream:
> https://github.com/vpelletier/python-libusb1/issues/81#issuecomment-983594180

I am not able to use the fix to apply clean on 2.0.1

+ /usr/bin/patch -p1 -s --fuzz=0 --no-backup-if-mismatch -f
+ /usr/bin/cat /home/jonny/fedora-scm/python-libusb1/032073e2bdd4634d6d55fb94a6f41bb5e5b15252.patch
21 out of 21 hunks FAILED -- saving rejects to file usb1/_version.py.rej
error: Bad exit status from /var/tmp/rpm-tmp.6aRNvk (%prep)

Comment 6 Hugo van Kemenade 2022-02-06 11:55:24 UTC
Try again with 3.0.0?

https://github.com/vpelletier/python-libusb1/issues/81#issuecomment-1030752193:

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



Note also that CPython has deferred these configparser removals from 3.11 to 3.12:

https://discuss.python.org/t/experience-with-python-3-11-in-fedora/12911/7?u=hugovk

Comment 7 Ben Cotton 2022-02-08 20:13:36 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 36 development cycle.
Changing version to 36.

Comment 8 Tomáš Hrnčiar 2022-02-10 10:55:10 UTC
As Hugo mentioned above, the configparser change was deferred so I am closing this bugzilla.