From 3ee6875e60f481140a2b7cc2b740e52fe9ee10e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20La=C3=ADns?= Date: Sat, 29 May 2021 16:11:31 +0100 Subject: [PATCH] remove support for setup.cfg only projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per the discussion in #9945. Signed-off-by: Filipe LaĆ­ns --- news/10031.bugfix | 3 +++ src/pip/_internal/req/req_install.py | 18 ++---------------- 2 files changed, 5 insertions(+), 16 deletions(-) create mode 100644 news/10031.bugfix diff --git a/news/10031.bugfix b/news/10031.bugfix new file mode 100644 index 00000000000..b9d2fd77742 --- /dev/null +++ b/news/10031.bugfix @@ -0,0 +1,3 @@ +Remove support for ``setup.cfg``-only projects. + +See the discussion in https://github.com/pypa/pip/pull/9945. diff --git a/src/pip/_internal/req/req_install.py b/src/pip/_internal/req/req_install.py index c2eea37123e..f4d6251412b 100644 --- a/src/pip/_internal/req/req_install.py +++ b/src/pip/_internal/req/req_install.py @@ -509,19 +509,6 @@ 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. @@ -529,10 +516,9 @@ def _generate_metadata(self): 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(