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/zip,
standalone pip creation for build environment reuses the source.

Resolves: pypa#9953
  • Loading branch information
abn committed May 7, 2021
1 parent e6414d6 commit b7aad97
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions news/9953.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix PEP 517 builds when pip is executed from within a wheel.
6 changes: 3 additions & 3 deletions src/pip/_internal/build_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -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. This can happen
# if a PEP 517 requirement is an sdist itself or when pip is already standalone.
if not source.is_dir():
yield str(source)
return

Expand Down

0 comments on commit b7aad97

Please sign in to comment.