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