[Provingground] Add check to crosdl.py
If gsutil is not installed, detect that early and bail.
TEST=correctly fails with other commands that are not insatlled
BUG=None
Change-Id: I7aa4e88a585df3b9471b4e96e1df3ce4033e53b9
Reviewed-on: https://chromium-review.googlesource.com/699050
Commit-Ready: Katherine Threlkeld <kathrelkeld@chromium.org>
Tested-by: Katherine Threlkeld <kathrelkeld@chromium.org>
Reviewed-by: Kalin Stoyanov <kalin@chromium.org>
diff --git a/provingground/crosdl.py b/provingground/crosdl.py
index 99510a9..e737291 100755
--- a/provingground/crosdl.py
+++ b/provingground/crosdl.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/env python2
# Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -127,6 +127,13 @@
'harddrive).'))
arguments = parser.parse_args()
+ # Ensure gsutil is installed.
+ try:
+ subprocess.check_output(['which', 'gsutil'])
+ except subprocess.CalledProcessError:
+ print ('Error finding gsutil! Please make sure it is installed.')
+ return
+
# Find src/ dir.
script_file_dir = os.path.dirname(os.path.realpath(__file__))
src_dir = os.path.join(script_file_dir, REL_SRC_DIR)