Skip to content

Commit

Permalink
Handle standalone pip creation from pip wheel
Browse files Browse the repository at this point in the history
This change ensures that when pip is executed from a wheel, standalone
pip creation for build environment reuses the wheel.

Resolves: pypa#9953
  • Loading branch information
abn committed May 6, 2021
1 parent e6414d6 commit 9eaf5a9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/pip/_internal/build_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,13 @@ 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 it is already a zip or wheel file. This can happen
# if a PEP 517 requirement is an sdist itself or pip is being executed from within
# a wheel respectively.
if not source.is_dir() and (
source.parent.name == "__env_pip__.zip"
or source.parent.suffix == ".whl"
):
yield str(source)
return

Expand Down

0 comments on commit 9eaf5a9

Please sign in to comment.