Skip to content

Commit

Permalink
remove support for setup.cfg only projects
Browse files Browse the repository at this point in the history
Per the discussion in pypa#9945.

Signed-off-by: Filipe Laíns <lains@riseup.net>
  • Loading branch information
FFY00 committed May 29, 2021
1 parent 8fe0011 commit 1b2d297
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions src/pip/_internal/req/req_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,30 +509,16 @@ def load_pyproject_toml(self):
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.
"""
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(
Expand Down

0 comments on commit 1b2d297

Please sign in to comment.