Преглед на файлове

depot_tools: Make it possible to run custom git scripts using Python 3.

Run custom git commands (e.g. git-cl, git-new-branch) using Python 3
when GCLIENT_PY3 is set to 1.

Bug: 984182
Change-Id: I81635b6cb83b2e0945d6596a7dc363f702075466
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2079704
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Edward Lemur преди 5 години
родител
ревизия
4d7d53b37d
променени са 1 файла, в които са добавени 10 реда и са изтрити 5 реда
  1. 10 5
      python_runner.sh

+ 10 - 5
python_runner.sh

@@ -50,10 +50,15 @@ PATH=$PATH:$DEPOT_TOOLS
 
 if [[ $PYTHON_DIRECT = 1 ]]; then
   python.exe "$DEPOT_TOOLS\\$SCRIPT" "$@"
-else
-  if [[ -e "$DEPOT_TOOLS/python.bat" && $OSTYPE = msys ]]; then
+elif [[ -e "$DEPOT_TOOLS/python.bat" && $OSTYPE = msys ]]; then
     cmd.exe //c "$DEPOT_TOOLS\\vpython.bat" "$DEPOT_TOOLS\\$SCRIPT" "$@"
-  else
-    vpython "$DEPOT_TOOLS/$SCRIPT" "$@"
-  fi
+elif [[ $GCLIENT_PY3 = 1 ]]; then
+  # Explicitly run on Python 3
+  vpython3 "$DEPOT_TOOLS/$SCRIPT" "$@"
+elif [[ $GCLIENT_PY3 = 0 ]]; then
+  # Explicitly run on Python 2
+  vpython "$DEPOT_TOOLS/$SCRIPT" "$@"
+else
+  # Run on Python 2 for now, allows default to be flipped.
+  vpython "$DEPOT_TOOLS/$SCRIPT" "$@"
 fi