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>
changes/04/2079704/3
Edward Lemur 5 years ago committed by LUCI CQ
parent 9f6558d37a
commit 4d7d53b37d

@ -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
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
fi

Loading…
Cancel
Save