Bug 2155476

Summary: python-pylero fails to build with Python 3.12: ImportError: cannot import name 'SafeConfigParser' from 'configparser' (/usr/lib64/python3.12/configparser.py).
Product: [Fedora] Fedora Reporter: Tomáš Hrnčiar <thrnciar>
Component: python-pyleroAssignee: Wayne Sun <gsun>
Status: CLOSED RAWHIDE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: gsun, jamato, lgangava, 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: 2023-01-20 08:16:29 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: 2135404    

Description Tomáš Hrnčiar 2022-12-21 10:46:22 UTC
python-pylero fails to build with Python 3.12.0a3.

Traceback (most recent call last):
  File "/builddir/build/BUILDROOT/python-pylero-0.0.4-1.fc38.x86_64/usr/lib/python3.12/site-packages/pylero/_compatible.py", line 55, in <module>
    from ConfigParser import SafeConfigParser
ModuleNotFoundError: No module named 'ConfigParser'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/rpm/redhat/import_all_modules.py", line 171, in <module>
    main()
  File "/usr/lib/rpm/redhat/import_all_modules.py", line 167, in main
    import_modules(modules)
  File "/usr/lib/rpm/redhat/import_all_modules.py", line 100, in import_modules
    importlib.import_module(module)
  File "/usr/lib64/python3.12/importlib/__init__.py", line 124, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1175, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1148, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1119, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 682, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 1007, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/builddir/build/BUILDROOT/python-pylero-0.0.4-1.fc38.x86_64/usr/lib/python3.12/site-packages/pylero/activity.py", line 7, in <module>
    from pylero.base_polarion import BasePolarion
  File "/builddir/build/BUILDROOT/python-pylero-0.0.4-1.fc38.x86_64/usr/lib/python3.12/site-packages/pylero/base_polarion.py", line 15, in <module>
    from pylero._compatible import basestring
  File "/builddir/build/BUILDROOT/python-pylero-0.0.4-1.fc38.x86_64/usr/lib/python3.12/site-packages/pylero/_compatible.py", line 57, in <module>
    from configparser import SafeConfigParser
ImportError: cannot import name 'SafeConfigParser' from 'configparser' (/usr/lib64/python3.12/configparser.py). Did you mean: 'RawConfigParser'?

Several names deprecated in the configparser way back in 3.2 have been removed per gh-89336:

    - configparser.ParsingError no longer has a filename attribute or argument. Use the source attribute and argument instead.

    - configparser no longer has a SafeConfigParser class. Use the shorter ConfigParser name instead.

    - configparser.ConfigParser no longer has a readfp method. Use read_file() instead.

https://docs.python.org/3.12/whatsnew/3.12.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.12/fedora-rawhide-x86_64/05133267-python-pylero/

For all our attempts to build python-pylero with Python 3.12, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.12/package/python-pylero/

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.12:
https://copr.fedorainfracloud.org/coprs/g/python/python3.12/

Let us know here if you have any questions.

Python 3.12 is planned to be included in Fedora 39. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.12.
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 Wayne Sun 2022-12-22 12:15:45 UTC
Updated with:
https://src.fedoraproject.org/rpms/python-pylero/pull-request/1

The build
https://copr.fedorainfracloud.org/coprs/g/python/python3.12/build/5166838/

now failed with:

Copr repository                                 111 kB/s | 3.7 kB     00:00    
Additional repo http_kojipkgs_fedoraproject_org 103 kB/s | 3.8 kB     00:00    
fedora                                          140 kB/s |  12 kB     00:00    
Package pyproject-rpm-macros-1.5.0-1.fc38.noarch is already installed.
Package python3-devel-3.12.0~a3-1.fc38.x86_64 is already installed.
Package python3-devel-3.12.0~a3-1.fc38.x86_64 is already installed.
Package python3-packaging-21.3-8.fc38~bootstrap.noarch is already installed.
Error: 
 Problem: package python3-setuptools_scm-7.1.0-1.fc38.noarch requires python(abi) = 3.11, but none of the providers can be installed
  - package python3-devel-3.12.0~a3-1.fc38.x86_64 conflicts with python3 < 3.12.0~a3-1.fc38 provided by python3-3.11.1-1.fc38.x86_64
  - package python3-devel-3.12.0~a3-1.fc38.x86_64 conflicts with python3 < 3.12.0~a3-1.fc38 provided by python3-3.11.1-1.fc38.i686
  - cannot install the best candidate for the job
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

due to setuptools_scm failure

Comment 2 Wayne Sun 2023-01-19 14:29:36 UTC
Build succeed:

https://copr.fedorainfracloud.org/coprs/g/python/python3.12/build/5251204/

with python-setuptools_scm-7.1.0-1

Comment 3 Tomáš Hrnčiar 2023-01-20 08:16:29 UTC
Thank you.