diff --git a/cipd_bin_setup.sh b/cipd_bin_setup.sh index aadf048dd..611d1539b 100644 --- a/cipd_bin_setup.sh +++ b/cipd_bin_setup.sh @@ -4,9 +4,19 @@ function cipd_bin_setup { local MYPATH=$(dirname "${BASH_SOURCE[0]}") + local ENSURE="$MYPATH/cipd_manifest.txt" + local ROOT="$MYPATH/.cipd_bin" + + UNAME=`uname -s | tr '[:upper:]' '[:lower:]'` + case $UNAME in + cygwin*) + ENSURE="$(cygpath -w $ENSURE)" + ROOT="$(cygpath -w $ROOT)" + ;; + esac "$MYPATH/cipd" ensure \ -log-level warning \ - -ensure-file "$MYPATH/cipd_manifest.txt" \ - -root "$MYPATH/.cipd_bin" + -ensure-file "$ENSURE" \ + -root "$ROOT" } diff --git a/gsutil.py b/gsutil.py index e8e9ca3cd..9e6d76e66 100755 --- a/gsutil.py +++ b/gsutil.py @@ -130,6 +130,16 @@ def run_gsutil(force_version, fallback, target, args, clean=False): 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).