From 3e31fca15bb5f9c404eeb707e4a43f925a92af5a Mon Sep 17 00:00:00 2001 From: "petermayo@chromium.org" Date: Fri, 28 Jun 2013 17:04:44 +0000 Subject: [PATCH] Add an alternate default boto file for bootstrapping source. Able to pull internal tools, but distinct from the source that those tools may eventually build. TBR=cmp@chromium.org BUG=252226 TEST=local buildslave Review URL: https://chromiumcodereview.appspot.com/17351008 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@209166 0039d316-1c4b-4281-b951-d872f2087c98 --- download_from_google_storage.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/download_from_google_storage.py b/download_from_google_storage.py index ee65b038b..38517efeb 100755 --- a/download_from_google_storage.py +++ b/download_from_google_storage.py @@ -42,23 +42,29 @@ class Gsutil(object): self.timeout = timeout self.boto_path = boto_path - def call(self, *args): + def get_sub_env(self): env = os.environ.copy() if self.boto_path: env['AWS_CREDENTIAL_FILE'] = self.boto_path + else: + custompath = env.get('AWS_CREDENTIAL_FILE', '~/.boto') + '.depot_tools' + custompath = os.path.expanduser(custompath) + if os.path.exists(custompath): + env['AWS_CREDENTIAL_FILE'] = custompath + + return env + + def call(self, *args): return subprocess2.call((sys.executable, self.path) + args, - env=env, + env=self.get_sub_env(), timeout=self.timeout) def check_call(self, *args): - env = os.environ.copy() - if self.boto_path: - env['AWS_CREDENTIAL_FILE'] = self.boto_path ((out, err), code) = subprocess2.communicate( (sys.executable, self.path) + args, stdout=subprocess2.PIPE, stderr=subprocess2.PIPE, - env=env, + env=self.get_sub_env(), timeout=self.timeout) # Parse output.