Merge pull request #10031 from FFY00/no-setup-cfg

Remove support for setup.cfg only projects
This commit is contained in:
Pradyun Gedam 2021-06-07 20:27:40 +01:00 committed by GitHub
commit e89dbbd03e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 16 deletions

1
news/10031.bugfix.rst Normal file
View File

@ -0,0 +1 @@
Require ``setup.cfg``-only projects to be built via PEP 517, by requiring an explicit dependency on setuptools declared in pyproject.toml.

View File

@ -509,19 +509,6 @@ class InstallRequirement:
self.unpacked_source_directory, backend, backend_path=backend_path,
)
def _check_setup_py_or_cfg_exists(self) -> bool:
"""Check if the requirement actually has a setuptools build file.
If setup.py does not exist, we also check setup.cfg in the same
directory and allow the directory if that exists.
"""
if os.path.exists(self.setup_py_path):
return True
stem, ext = os.path.splitext(self.setup_py_path)
if ext == ".py" and os.path.exists(f"{stem}.cfg"):
return True
return False
def _generate_metadata(self):
# type: () -> str
"""Invokes metadata generator functions, with the required arguments.
@ -529,10 +516,9 @@ class InstallRequirement:
if not self.use_pep517:
assert self.unpacked_source_directory
if not self._check_setup_py_or_cfg_exists():
if not os.path.exists(self.setup_py_path):
raise InstallationError(
f'File "setup.py" or "setup.cfg" not found for legacy '
f'project {self}.'
f'File "setup.py" not found for legacy project {self}.'
)
return generate_metadata_legacy(