Gentoo Archives: gentoo-catalyst

From: Mike Frysinger <vapier@g.o>
To: gentoo-catalyst@l.g.o
Subject: [gentoo-catalyst] [PATCH] lint: fix bad env dict handling
Date: Tue, 06 Oct 2015 03:48:05
Message-Id: 1444103282-14476-1-git-send-email-vapier@gentoo.org
1 By using a kwarg default of {}, the value is retained across multiple
2 calls (and the linter warns about it). Use the standard "if None"
3 style to avoid that.
4
5 Also fix the write to the dict passed in by creating a local copy
6 before we insert BASH_ENV into it.
7 ---
8 catalyst/support.py | 5 ++++-
9 1 file changed, 4 insertions(+), 1 deletion(-)
10
11 diff --git a/catalyst/support.py b/catalyst/support.py
12 index b6705c9..78942a7 100644
13 --- a/catalyst/support.py
14 +++ b/catalyst/support.py
15 @@ -120,11 +120,14 @@ def find_binary(myc):
16 return None
17
18
19 -def cmd(mycmd, myexc="", env={}, debug=False, fail_func=None):
20 +def cmd(mycmd, myexc="", env=None, debug=False, fail_func=None):
21 + if env is None:
22 + env = {}
23 #print "***** cmd()"
24 sys.stdout.flush()
25 args=[BASH_BINARY]
26 if "BASH_ENV" not in env:
27 + env = env.copy()
28 env["BASH_ENV"] = "/etc/spork/is/not/valid/profile.env"
29 if debug:
30 args.append("-x")
31 --
32 2.5.2

Replies

Subject Author
Re: [gentoo-catalyst] [PATCH] lint: fix bad env dict handling Brian Dolbec <dolsen@g.o>