Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add a way to use exiting env values in extend_env

  • Loading branch information...
commit d9bec51441e236263e297307063e758418f8feee 1 parent d95fc11
@wuub wuub authored
Showing with 10 additions and 1 deletion.
  1. +1 −0  .gitignore
  2. +9 −1 subprocess_repl.py
View
1  .gitignore
@@ -0,0 +1 @@
+*.pyc
View
10 subprocess_repl.py
@@ -33,7 +33,7 @@ def env(self, env, extend_env):
import os
updated_env = env if env else os.environ.copy()
if extend_env:
- updated_env.update(extend_env)
+ updated_env.update(self.interpolate_extend_env(updated_env, extend_env))
bytes_env = {}
for k,v in updated_env.items():
enc_k = self.encoder(unicode(k))[0]
@@ -41,6 +41,14 @@ def env(self, env, extend_env):
bytes_env[enc_k] = enc_v
return bytes_env
+ def interpolate_extend_env(self, env, extend_env):
+ """Interpolates (subst) values in extend_env.
+ Mostly for path manipulation"""
+ new_env = {}
+ for key, val in extend_env.items():
+ new_env[key] = val.format(**env)
+ return new_env
+
def startupinfo(self):
startupinfo = None
if os.name == 'nt':
Please sign in to comment.
Something went wrong with that request. Please try again.