From 3c814957ee532260024e544bf10230348bbc4909 Mon Sep 17 00:00:00 2001 From: Edward Lemur Date: Mon, 12 Aug 2019 19:43:00 +0000 Subject: [PATCH] depot_tools: Run Python scripts using vpython (Part 2) Tbr: iannucci@chromium.org Bug: 984182 Change-Id: I2e8469f8ee0acd6a54109697d5a6b76faf24fa42 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1748590 Reviewed-by: Edward Lesmes Commit-Queue: Edward Lesmes --- download_from_google_storage | 2 +- download_from_google_storage.bat | 2 +- download_from_google_storage.py | 2 +- fetch | 2 +- fetch.bat | 2 +- fetch.py | 2 +- gclient | 29 ++++++++++++++++------------- gclient-new-workdir.py | 2 +- gclient.bat | 7 ++++++- gclient.py | 2 +- roll-dep | 2 +- roll-dep-svn | 2 +- roll-dep-svn.bat | 2 +- roll-dep.bat | 2 +- roll_dep.py | 2 +- roll_dep_svn.py | 2 +- 16 files changed, 36 insertions(+), 28 deletions(-) diff --git a/download_from_google_storage b/download_from_google_storage index 74e1e83f93..41d6e81236 100755 --- a/download_from_google_storage +++ b/download_from_google_storage @@ -5,4 +5,4 @@ base_dir=$(dirname "$0") -PYTHONDONTWRITEBYTECODE=1 exec python "$base_dir/download_from_google_storage.py" "$@" +PYTHONDONTWRITEBYTECODE=1 exec $base_dir/vpython "$base_dir/download_from_google_storage.py" "$@" diff --git a/download_from_google_storage.bat b/download_from_google_storage.bat index f1f2d21616..f050082289 100755 --- a/download_from_google_storage.bat +++ b/download_from_google_storage.bat @@ -9,4 +9,4 @@ setlocal set PATH=%PATH%;%~dp0 :: Defer control. -python "%~dp0\download_from_google_storage.py" %* +%~dp0\vpython "%~dp0\download_from_google_storage.py" %* diff --git a/download_from_google_storage.py b/download_from_google_storage.py index 3dcc862439..57378aae21 100755 --- a/download_from_google_storage.py +++ b/download_from_google_storage.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env vpython # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/fetch b/fetch index bea6718c77..3a940a2879 100755 --- a/fetch +++ b/fetch @@ -5,4 +5,4 @@ base_dir=$(dirname "$0") -PYTHONDONTWRITEBYTECODE=1 exec python "$base_dir/fetch.py" "$@" +PYTHONDONTWRITEBYTECODE=1 exec $base_dir/vpython "$base_dir/fetch.py" "$@" diff --git a/fetch.bat b/fetch.bat index 5f8019a19d..3e226538c6 100755 --- a/fetch.bat +++ b/fetch.bat @@ -12,4 +12,4 @@ call "%~dp0\update_depot_tools.bat" set PATH=%PATH%;%~dp0 :: Defer control. -python "%~dp0\fetch.py" %* +%~dp0\vpython "%~dp0\fetch.py" %* diff --git a/fetch.py b/fetch.py index 56abfb9a6d..72e52c7967 100755 --- a/fetch.py +++ b/fetch.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env vpython # Copyright (c) 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/gclient b/gclient index 4ff6b3cbda..22c9295eba 100755 --- a/gclient +++ b/gclient @@ -5,18 +5,21 @@ base_dir=$(dirname "$0") -if [[ "#grep#fetch#cleanup#diff#setdep#" != *"#$1#"* ]]; then - "$base_dir"/update_depot_tools "$@" - case $? in - 123) - # msys environment was upgraded, need to quit. - exit 0 - ;; - 0) - ;; - *) - exit $? - esac +# Update depot_tools unless DEPOT_TOOLS_UPDATE is set to 0 +if [ "X$DEPOT_TOOLS_UPDATE" != "X0" ]; then + if [[ "#grep#fetch#cleanup#diff#setdep#" != *"#$1#"* ]]; then + "$base_dir"/update_depot_tools "$@" + case $? in + 123) + # msys environment was upgraded, need to quit. + exit 0 + ;; + 0) + ;; + *) + exit $? + esac + fi fi -PYTHONDONTWRITEBYTECODE=1 exec python "$base_dir/gclient.py" "$@" +PYTHONDONTWRITEBYTECODE=1 exec $base_dir/vpython "$base_dir/gclient.py" "$@" diff --git a/gclient-new-workdir.py b/gclient-new-workdir.py index e9eee62b1a..621606dd81 100755 --- a/gclient-new-workdir.py +++ b/gclient-new-workdir.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env vpython # Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/gclient.bat b/gclient.bat index 5aaff866c5..7b7acf5132 100755 --- a/gclient.bat +++ b/gclient.bat @@ -4,12 +4,17 @@ :: found in the LICENSE file. setlocal +:: Shall skip automatic update? +IF "%DEPOT_TOOLS_UPDATE%" == "0" GOTO :SKIP_UPDATE + :: Synchronize the root directory before deferring control back to gclient.py. call "%~dp0update_depot_tools.bat" %* +:SKIP_UPDATE + :: Ensure that "depot_tools" is somewhere in PATH so this tool can be used :: standalone, but allow other PATH manipulations to take priority. set PATH=%PATH%;%~dp0 :: Defer control. -python "%~dp0gclient.py" %* +%~dp0\vpython "%~dp0\gclient.py" %* diff --git a/gclient.py b/gclient.py index f940f68308..35df62f1d6 100755 --- a/gclient.py +++ b/gclient.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env vpython # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/roll-dep b/roll-dep index 19ddb8058a..8875bef75a 100755 --- a/roll-dep +++ b/roll-dep @@ -5,4 +5,4 @@ base_dir=$(dirname "$0") -PYTHONDONTWRITEBYTECODE=1 exec python "$base_dir/roll_dep.py" "$@" +PYTHONDONTWRITEBYTECODE=1 exec $base_dir/vpython "$base_dir/roll_dep.py" "$@" diff --git a/roll-dep-svn b/roll-dep-svn index 1d65c7b484..f4f3a3fd92 100755 --- a/roll-dep-svn +++ b/roll-dep-svn @@ -5,4 +5,4 @@ base_dir=$(dirname "$0") -PYTHONDONTWRITEBYTECODE=1 exec python "$base_dir/roll_dep_svn.py" "$@" +PYTHONDONTWRITEBYTECODE=1 exec $base_dir/vpython "$base_dir/roll_dep_svn.py" "$@" diff --git a/roll-dep-svn.bat b/roll-dep-svn.bat index 6ff5db78f1..af6ccd8d8b 100755 --- a/roll-dep-svn.bat +++ b/roll-dep-svn.bat @@ -9,4 +9,4 @@ setlocal set PATH=%PATH%;%~dp0 :: Defer control. -python "%~dp0\roll_dep_svn.py" %* +%~dp0\vpython "%~dp0\roll_dep_svn.py" %* diff --git a/roll-dep.bat b/roll-dep.bat index c49c88dc51..9b4cfee78d 100755 --- a/roll-dep.bat +++ b/roll-dep.bat @@ -9,4 +9,4 @@ setlocal set PATH=%PATH%;%~dp0 :: Defer control. -python "%~dp0\roll_dep.py" %* +%~dp0\vpython "%~dp0\roll_dep.py" %* diff --git a/roll_dep.py b/roll_dep.py index a41be48120..4c20d5b66b 100755 --- a/roll_dep.py +++ b/roll_dep.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env vpython # Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/roll_dep_svn.py b/roll_dep_svn.py index a7c9a28033..c569969cf6 100755 --- a/roll_dep_svn.py +++ b/roll_dep_svn.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env vpython # Copyright (c) 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file.