From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 54D6813888F for ; Tue, 6 Oct 2015 03:48:05 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B7EC821C012; Tue, 6 Oct 2015 03:48:04 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 4EF2921C012 for ; Tue, 6 Oct 2015 03:48:04 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 7696E340836 for ; Tue, 6 Oct 2015 03:48:03 +0000 (UTC) From: Mike Frysinger To: gentoo-catalyst@lists.gentoo.org Subject: [gentoo-catalyst] [PATCH] lint: fix bad env dict handling Date: Mon, 5 Oct 2015 23:48:02 -0400 Message-Id: <1444103282-14476-1-git-send-email-vapier@gentoo.org> X-Mailer: git-send-email 2.5.2 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-catalyst@lists.gentoo.org Reply-to: gentoo-catalyst@lists.gentoo.org X-Archives-Salt: 1b41310b-7647-4b21-b5fb-cdfa84fc6247 X-Archives-Hash: 41907ef34fef7937f0901c2c5bd30b5e 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") -- 2.5.2