Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Unified Diff: dart/tools/bots/bot_utils.py

Issue 23494056: Use shell script on buildbot to call gsutil otherwise the python script (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/tools/bots/bot_utils.py
diff --git a/dart/tools/bots/bot_utils.py b/dart/tools/bots/bot_utils.py
index dde5ddf49f7c887974334a879134c617b980f5b6..5885378b5c5659e71cfd8d4cff43450084b1820b 100644
--- a/dart/tools/bots/bot_utils.py
+++ b/dart/tools/bots/bot_utils.py
@@ -144,19 +144,25 @@ def run(command, env=None):
raise Exception("Failed to execute %s." % command)
class GSUtil(object):
+ GSUTIL_IS_SHELL_SCRIPT = False
GSUTIL_PATH = None
-
+
def _layzCalculateGSUtilPath(self):
if not GSUtil.GSUTIL_PATH:
- dart_gsutil = os.path.join(DART_DIR, 'third_party', 'gsutil', 'gsutil')
buildbot_gsutil = os.path.dirname(utils.GetBuildbotGSUtilPath())
- possible_locations = (list(os.environ['PATH'].split(os.pathsep))
- + [dart_gsutil, buildbot_gsutil])
- for directory in possible_locations:
- location = os.path.join(directory, 'gsutil')
- if os.path.isfile(location):
- GSUtil.GSUTIL_PATH = location
- break
+ if os.path.isfile(buildbot_gsutil):
+ GSUtil.GSUTIL_IS_SHELL_SCRIPT = True
+ GSUtil.GSUTIL_PATH = buildbot_gsutil
+ else:
+ dart_gsutil = os.path.join(DART_DIR, 'third_party', 'gsutil', 'gsutil')
+ possible_locations = (list(os.environ['PATH'].split(os.pathsep))
+ + [dart_gsutil])
+ for directory in possible_locations:
+ location = os.path.join(directory, 'gsutil')
+ if os.path.isfile(location):
+ GSUtil.GSUTIL_IS_SHELL_SCRIPT = False
+ GSUtil.GSUTIL_PATH = location
+ break
assert GSUtil.GSUTIL_PATH
def execute(self, gsutil_args):
@@ -172,8 +178,13 @@ class GSUtil(object):
}[utils.GuessOS()]
env['AWS_CREDENTIAL_FILE'] = boto_config
env['BOTO_CONFIG'] = boto_config
- run([sys.executable, GSUtil.GSUTIL_PATH] + gsutil_args,
- env=env)
+
+ if GSUtil.GSUTIL_IS_SHELL_SCRIPT:
+ gsutil_command = [GSUtil.GSUTIL_PATH]
+ else:
+ gsutil_command = [sys.executable, GSUtil.GSUTIL_PATH]
+
+ run(gsutil_command + gsutil_args, env=env)
def upload(self, local_path, remote_path, recursive=False, public=False):
assert remote_path.startswith('gs://')
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698