瀏覽代碼

git-cl: Run using vpython

Bug: 1002153
Change-Id: I02ffa574f072575c4b6662a7f32678428ed3f85d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1845498
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Edward Lemur 5 年之前
父節點
當前提交
1f3bafbab4
共有 4 個文件被更改,包括 9 次插入3 次删除
  1. 1 0
      .gitattributes
  2. 1 0
      .vpython
  3. 1 1
      git_cl.py
  4. 6 2
      python_runner.sh

+ 1 - 0
.gitattributes

@@ -10,6 +10,7 @@
 /*.sh  recipes
 
 # vpython specs
+/.vpython*      recipes
 /gsutil.vpython recipes
 
 # Extensionless tools we want and support scripts.

+ 1 - 0
.vpython

@@ -0,0 +1 @@
+python_version: "2.7"

+ 1 - 1
git_cl.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.

+ 6 - 2
python_runner.sh

@@ -44,12 +44,16 @@ fi
 
 SCRIPT="${SCRIPT-${BASENAME//-/_}.py}"
 
+# Ensure that "depot_tools" is somewhere in PATH so this tool can be used
+# standalone, but allow other PATH manipulations to take priority.
+PATH=$PATH:$DEPOT_TOOLS
+
 if [[ $PYTHON_DIRECT = 1 ]]; then
   python.exe "$DEPOT_TOOLS\\$SCRIPT" "$@"
 else
   if [[ -e "$DEPOT_TOOLS/python.bat" && $OSTYPE = msys ]]; then
-    cmd.exe //c "$DEPOT_TOOLS\\python.bat" "$DEPOT_TOOLS\\$SCRIPT" "$@"
+    cmd.exe //c "$DEPOT_TOOLS\\vpython.bat" "$DEPOT_TOOLS\\$SCRIPT" "$@"
   else
-    exec "$DEPOT_TOOLS/$SCRIPT" "$@"
+    vpython "$DEPOT_TOOLS/$SCRIPT" "$@"
   fi
 fi