Description
setuptools version
65.5.1-65.6.3
Python version
Python 3.11.1
OS
Fedora Linux
Additional environment information
This was observed in Fedora Linux as soon as we updated to 3.11.1
Description
Since python/cpython@07734a4 setuptools builds have started failing on Fedora.
It seems there are two issues I've discovered so far and bisecting the problem led me to the specific Python commit.
First when trying to build setuptools through the pypi tarball after an initial bootstrap build (meaning we delete the egg-info directory on the second build) and then our pyproject script tries to generate the build requirements we get a KeyError: 'entry_points'
error.
Secondly if I add the build requirements manually and then create the wheel through python3 setup.py bdist_wheel
after again removing the pre-generated egg-info directory I get an error: [Errno 2] No such file or directory: 'build/bdist.linux-x86_64/wheel/setuptools-65.6.3-py3.11.egg-info/PKG-INFO'
error.
Tested it from 65.5.1 and on-wards. By removing that commit or by not removing the egg-info directory, everything works like before.
Expected behavior
Expected for the errors not to happen
How to Reproduce
For the first part:
On a Fedora 37 or Rawhide system
dnf install python3.11
which will bring you the latest Python 3.11.1 or compile CPython from the v3.11.1 tag
Get the setuptools tarball from pypi and unzip it
Delete the egg-info directory
dnf install '/usr/lib/rpm/redhat/pyproject_buildrequires.py'
And inside the dir do python3 -B /usr/lib/rpm/redhat/pyproject_buildrequires.py --generate-extras --python3_pkgversion 3
By downgrading to 3.11.0 or skipping python/cpython@07734a4 the issue disappears.
For the second part:
A reproducer which should be non-fedora specific although it shows a different error.
Compile and/or install Python 3.11.1
In a system where setuptools is already installed.
Get the pypi tarball
Unzip it and delete the egg-info directory
Install wheel
python3 setup.py bdist_wheel
Same as before, if I downgrade to 3.11.0 or skip the specific commit the issue disappears.
Output
First part:
$ python3 -B /usr/lib/rpm/redhat/pyproject_buildrequires.py --generate-extras --python3_pkgversion 3
/builddir/setuptools-65.6.3/setuptools/command/egg_info.py:643: SetuptoolsDeprecationWarning: Custom 'build_py' does not implement 'get_data_files_without_manifest'.
Please extend command classes from setuptools instead of distutils.
warnings.warn(
warning: no files found matching '*.py' under directory 'tests'
warning: no files found matching '*.txt' under directory 'docs'
warning: no files found matching '*.conf' under directory 'docs'
warning: no files found matching '*.css' under directory 'docs'
warning: no files found matching '*.css_t' under directory 'docs'
warning: no files found matching 'Makefile' under directory 'docs'
warning: no files found matching 'indexsidebar.html' under directory 'docs'
warning: no files found matching 'msvc-build-launcher.cmd'
HOOK STDOUT: running egg_info
HOOK STDOUT: creating setuptools.egg-info
HOOK STDOUT: writing manifest file 'setuptools.egg-info/SOURCES.txt'
HOOK STDOUT: reading manifest file 'setuptools.egg-info/SOURCES.txt'
HOOK STDOUT: reading manifest template 'MANIFEST.in'
HOOK STDOUT: adding license file 'LICENSE'
HOOK STDOUT: writing manifest file 'setuptools.egg-info/SOURCES.txt'
Handling wheel from get_requires_for_build_wheel
Requirement satisfied: wheel
(installed: wheel 0.38.4)
python3dist(wheel)
Traceback (most recent call last):
File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 508, in main
generate_requires(
File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 420, in generate_requires
generate_run_requirements(backend, requirements, build_wheel=build_wheel, wheeldir=wheeldir)
File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 330, in generate_run_requirements
generate_run_requirements_hook(backend, requirements)
File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 286, in generate_run_requirements_hook
dir_basename = prepare_metadata('.')
^^^^^^^^^^^^^^^^^^^^^
File "/builddir/setuptools-65.6.3/setuptools/build_meta.py", line 377, in prepare_metadata_for_build_wheel
self.run_setup()
File "/builddir/setuptools-65.6.3/setuptools/build_meta.py", line 335, in run_setup
exec(code, locals())
File "<string>", line 87, in <module>
File "/builddir/setuptools-65.6.3/setuptools/__init__.py", line 87, in setup
return distutils.core.setup(**attrs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/builddir/setuptools-65.6.3/setuptools/_distutils/core.py", line 159, in setup
dist.parse_config_files()
File "/builddir/setuptools-65.6.3/setuptools/dist.py", line 863, in parse_config_files
setupcfg.parse_configuration(
File "/builddir/setuptools-65.6.3/setuptools/config/setupcfg.py", line 162, in parse_configuration
options.parse()
File "/builddir/setuptools-65.6.3/setuptools/config/setupcfg.py", line 496, in parse
section_parser_method(section_options)
File "/builddir/setuptools-65.6.3/setuptools/config/setupcfg.py", line 724, in parse_section_entry_points
self['entry_points'] = parsed
~~~~^^^^^^^^^^^^^^^^
File "/builddir/setuptools-65.6.3/setuptools/config/setupcfg.py", line 268, in __setitem__
raise KeyError(option_name)
KeyError: 'entry_points'
Second part:
$ python3 setup.py bdist_wheel
<snip>
running egg_info
creating setuptools.egg-info
writing manifest file 'setuptools.egg-info/SOURCES.txt'
reading manifest file 'setuptools.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.py' under directory 'tests'
warning: no files found matching '*.txt' under directory 'docs'
warning: no files found matching '*.conf' under directory 'docs'
warning: no files found matching '*.css' under directory 'docs'
warning: no files found matching '*.css_t' under directory 'docs'
warning: no files found matching 'Makefile' under directory 'docs'
warning: no files found matching 'indexsidebar.html' under directory 'docs'
warning: no files found matching 'msvc-build-launcher.cmd'
adding license file 'LICENSE'
writing manifest file 'setuptools.egg-info/SOURCES.txt'
Copying setuptools.egg-info to build/bdist.linux-x86_64/wheel/setuptools-65.6.3-py3.11.egg-info
running install_scripts
creating build/bdist.linux-x86_64/wheel/distutils-precedence.pth
error: [Errno 2] No such file or directory: 'build/bdist.linux-x86_64/wheel/setuptools-65.6.3-py3.11.egg-info/PKG-INFO'