From b5f10609cd16c1b46f15015b8810a02483e6f0a7 Mon Sep 17 00:00:00 2001 From: Arun Babu Neelicattu Date: Thu, 6 May 2021 22:14:28 +0200 Subject: [PATCH] Handle standalone pip creation from pip wheel This change ensures that when pip is executed from a wheel/zip, standalone pip creation for build environment reuses the source. Resolves: #9953 --- news/9953.bugfix.rst | 1 + src/pip/_internal/build_env.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 news/9953.bugfix.rst diff --git a/news/9953.bugfix.rst b/news/9953.bugfix.rst new file mode 100644 index 00000000000..f8e4a17ef14 --- /dev/null +++ b/news/9953.bugfix.rst @@ -0,0 +1 @@ +Fix PEP 517 builds when pip is executed from within a wheel. diff --git a/src/pip/_internal/build_env.py b/src/pip/_internal/build_env.py index cdf04324107..680e49f5b38 100644 --- a/src/pip/_internal/build_env.py +++ b/src/pip/_internal/build_env.py @@ -50,9 +50,9 @@ def _create_standalone_pip() -> Iterator[str]: """ source = pathlib.Path(pip_location).resolve().parent - # Return the current instance if it is already a zip file. This can happen - # if a PEP 517 requirement is an sdist itself. - if not source.is_dir() and source.parent.name == "__env_pip__.zip": + # Return the current instance if `source` is not a directory. We can't build + # a zip from this, and it likely means the instance is already standalone. + if not source.is_dir(): yield str(source) return