Fix depot_tools errors that cause runhooks to be inoperable for Cygwin
The vpython/CIPD work created some errors when attempting to build on
Cygwin. This patch fixes these errors by converting Cygwin paths to
Windows paths or using the depot_tools python instead of Cygwin python.
Bug:
Change-Id: Id62f59a357fa2937c7eb843bf306ef4303b0910e
Reviewed-on: https://chromium-review.googlesource.com/745727
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Vadim Shtayura <vadimsh@chromium.org>
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
diff --git a/gsutil.py b/gsutil.py
index e8e9ca3..9e6d76e 100755
--- a/gsutil.py
+++ b/gsutil.py
@@ -130,6 +130,16 @@
gsutil_bin = fallback
disable_update = ['-o', 'GSUtil:software_update_check_period=0']
+ if sys.platform == 'cygwin':
+ # This script requires Windows Python, so invoke with depot_tools'
+ # Python.
+ def winpath(path):
+ return subprocess.check_output(['cygpath', '-w', path]).strip()
+ cmd = ['python.bat', winpath(__file__)]
+ cmd.extend(args)
+ sys.exit(subprocess.call(cmd))
+ assert sys.platform != 'cygwin'
+
# Run "gsutil" through "vpython". We need to do this because on GCE instances,
# expectations are made about Python having access to "google-compute-engine"
# and "boto" packages that are not met with non-system Python (e.g., bundles).