vpython: use the Chromium version on all platforms

We have a python2 binary available on all platforms already, so use
that instead of relying on the system copy.  This provides consistent
behavior across all platforms and avoids the impending doom when host
distros stop providing python2 packages.

Change-Id: Id48fe343291ba70981a1a65526ba80d1f7ae7d73
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2785114
Reviewed-by: Dirk Pranke <dpranke@google.com>
Reviewed-by: Brian Ryner <bryner@google.com>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
Mike Frysinger
2021-03-30 02:09:47 +00:00
committed by LUCI CQ
parent 9781115e15
commit 5260b2b204

15
vpython
View File

@@ -39,4 +39,17 @@ base_dir=$(dirname "$0")
source "$base_dir/cipd_bin_setup.sh"
cipd_bin_setup &> /dev/null
exec "$base_dir/.cipd_bin/vpython" "$@"
# If Python bootstrapping is not disabled, make sure Python has been
# bootstrapped and add it to the front of PATH.
if [[ $(uname -s) = MINGW* || $(uname -s) = CYGWIN* ]]; then
cmd.exe //c $0.bat "$@"
elif [[ $DEPOT_TOOLS_BOOTSTRAP_PYTHON3 != 0 ]]; then
if [[ ! -e "$base_dir/python_bin_reldir.txt" ]]; then
source "$base_dir/bootstrap_python3"
bootstrap_python3
fi
PYTHON_BIN_RELDIR="$base_dir/$(cat "$base_dir/python_bin_reldir.txt" | xargs echo)"
exec "$base_dir/.cipd_bin/vpython" -vpython-interpreter "$PYTHON_BIN_RELDIR/python" "$@"
else
exec "$base_dir/.cipd_bin/vpython" "$@"
fi