-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: install dev package in its own prefix
This prevents any dependency layers from removing the dev package dependencies from the base environment.
- Loading branch information
Showing
4 changed files
with
73 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
fixes: | ||
- | | ||
Fixed a problem that caused dependency layers to uninstall some dev package | ||
dependencies from the base virtual environment. |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import os | ||
|
||
from pip._internal.build_env import BuildEnvironment as BE | ||
|
||
original_be_enter = BE.__enter__ | ||
|
||
|
||
def be_enter(self): | ||
pythonpath = os.getenv("PYTHONPATH") | ||
try: | ||
return original_be_enter(self) | ||
finally: | ||
# We fix the PYTHONPATH override done by pip before returning | ||
if pythonpath is not None: | ||
os.environ["PYTHONPATH"] = os.pathsep.join( | ||
(os.getenv("PYTHONPATH"), pythonpath) | ||
) | ||
|
||
|
||
# pip does not support edit install with prefix in Python 2 | ||
# https://github.com/pypa/pip/issues/7627 | ||
BE.__enter__ = be_enter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters