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
Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
This commit is contained in:
Arun Babu Neelicattu 2021-05-06 22:14:28 +02:00
parent e6414d6db6
commit 8ef383bb23
2 changed files with 4 additions and 3 deletions

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

@ -0,0 +1 @@
Fix detection of existing standalone pip instance for PEP 517 builds.

View File

@ -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