commit: ecbe93c9794d714e6fb05f3c06a30699667371fd
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 6 03:27:01 2015 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Tue Oct 6 03:27:01 2015 +0000
URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=ecbe93c9
lint: fix bad env dict handling
By using a kwarg default of {}, the value is retained across multiple
calls (and the linter warns about it). Use the standard "if None"
style to avoid that.
Also fix the write to the dict passed in by creating a local copy
before we insert BASH_ENV into it.
catalyst/support.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/catalyst/support.py b/catalyst/support.py
index b6705c9..78942a7 100644
--- a/catalyst/support.py
+++ b/catalyst/support.py
@@ -120,11 +120,14 @@ def find_binary(myc):
return None
-def cmd(mycmd, myexc="", env={}, debug=False, fail_func=None):
+def cmd(mycmd, myexc="", env=None, debug=False, fail_func=None):
+ if env is None:
+ env = {}
#print "***** cmd()"
sys.stdout.flush()
args=[BASH_BINARY]
if "BASH_ENV" not in env:
+ env = env.copy()
env["BASH_ENV"] = "/etc/spork/is/not/valid/profile.env"
if debug:
args.append("-x")