Bug 2196468

Summary: dtc fails to build with Python 3.12: pylibfdt: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
Product: [Fedora] Fedora Reporter: Tomáš Hrnčiar <thrnciar>
Component: dtcAssignee: Peter Robinson <pbrobinson>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: arnd, jwboyer, mhroncok, pbonzini, pbrobinson, 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-08-06 16:05:19 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 2023-05-09 09:49:02 UTC
dtc fails to build with Python 3.12.0a7.

/usr/lib/python3.12/site-packages/setuptools/__init__.py:84: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
!!

        ********************************************************************************
        Requirements should be satisfied by a PEP 517 installer.
        If you are using pip, you can try `pip install --use-pep517`.
        ********************************************************************************

!!
  dist.fetch_build_eggs(dist.setup_requires)
WARNING: The wheel package is not available.
/usr/bin/python3: No module named pip
Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/setuptools/installer.py", line 96, in _fetch_build_egg_no_warn
    subprocess.check_call(cmd)
  File "/usr/lib64/python3.12/subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpjznjreia', '--quiet', 'setuptools_scm']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/builddir/build/BUILD/dtc-1.7.0/./setup.py", line 50, in <module>
    setup(
  File "/usr/lib/python3.12/site-packages/setuptools/__init__.py", line 106, in setup
    _install_setup_requires(attrs)
  File "/usr/lib/python3.12/site-packages/setuptools/__init__.py", line 79, in _install_setup_requires
    _fetch_build_eggs(dist)
  File "/usr/lib/python3.12/site-packages/setuptools/__init__.py", line 84, in _fetch_build_eggs
    dist.fetch_build_eggs(dist.setup_requires)
  File "/usr/lib/python3.12/site-packages/setuptools/dist.py", line 917, in fetch_build_eggs
    return _fetch_build_eggs(self, requires)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/setuptools/installer.py", line 38, in _fetch_build_eggs
    resolved_dists = pkg_resources.working_set.resolve(
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/pkg_resources/__init__.py", line 827, in resolve
    dist = self._resolve_dist(
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/pkg_resources/__init__.py", line 863, in _resolve_dist
    dist = best[req.key] = env.best_match(
                           ^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/pkg_resources/__init__.py", line 1133, in best_match
    return self.obtain(req, installer)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/pkg_resources/__init__.py", line 1145, in obtain
    return installer(requirement)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/setuptools/installer.py", line 98, in _fetch_build_egg_no_warn
    raise DistutilsError(str(e)) from e
distutils.errors.DistutilsError: Command '['/usr/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpjznjreia', '--quiet', 'setuptools_scm']' returned non-zero exit status 1.

Using the setup.py install is deprecated. Migrating to pyproject.toml should help. 

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/05899996-dtc/

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

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.