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