summaryrefslogtreecommitdiff
path: root/src/virtualenv/create
diff options
context:
space:
mode:
authorBernát Gábor <bgabor8@bloomberg.net>2021-01-18 16:06:22 +0000
committerGitHub <noreply@github.com>2021-01-18 16:06:22 +0000
commit40aec4824e04963185d1f5e218b6a1c0c86ce3df (patch)
treedac3d5f5ecdb85b9cfa027aae8ec5a2d70fb06fa /src/virtualenv/create
parent4c9550697d33cd9d770d98973fa8ff7a8b4df363 (diff)
downloadvirtualenv-40aec4824e04963185d1f5e218b6a1c0c86ce3df.tar.gz
API: Allow passing on the environment variable as an argument (#2054)
Defaults to os.environ. Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
Diffstat (limited to 'src/virtualenv/create')
-rw-r--r--src/virtualenv/create/creator.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/virtualenv/create/creator.py b/src/virtualenv/create/creator.py
index 1b4ea69..6363f8b 100644
--- a/src/virtualenv/create/creator.py
+++ b/src/virtualenv/create/creator.py
@@ -47,6 +47,7 @@ class Creator(object):
self.no_vcs_ignore = options.no_vcs_ignore
self.pyenv_cfg = PyEnvCfg.from_folder(self.dest)
self.app_data = options.app_data
+ self.env = options.env
def __repr__(self):
return ensure_str(self.__unicode__())
@@ -204,7 +205,7 @@ class Creator(object):
:return: debug information about the virtual environment (only valid after :meth:`create` has run)
"""
if self._debug is None and self.exe is not None:
- self._debug = get_env_debug_info(self.exe, self.debug_script(), self.app_data)
+ self._debug = get_env_debug_info(self.exe, self.debug_script(), self.app_data, self.env)
return self._debug
# noinspection PyMethodMayBeStatic
@@ -212,8 +213,8 @@ class Creator(object):
return DEBUG_SCRIPT
-def get_env_debug_info(env_exe, debug_script, app_data):
- env = os.environ.copy()
+def get_env_debug_info(env_exe, debug_script, app_data, env):
+ env = env.copy()
env.pop(str("PYTHONPATH"), None)
with app_data.ensure_extracted(debug_script) as debug_script: