smut | 447b45d | 2019-07-31 21:26:27 +0000 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | # Copyright 2019 The Chromium Authors. All rights reserved. |
| 4 | # Use of this source code is governed by a BSD-style license that can be |
| 5 | # found in the LICENSE file. |
| 6 | |
| 7 | if [[ $VPYTHON_BYPASS == "manually managed python not supported by chrome operations" ]] |
| 8 | then |
| 9 | NEWARGS=() |
| 10 | while [[ $# -gt 0 ]] |
| 11 | do |
| 12 | case "$1" in |
| 13 | -vpython-tool*) # these tools all do something vpython related and quit |
| 14 | exit 0 |
| 15 | ;; |
| 16 | -vpython*=*) # delete any vpython-specific flag (w/ attached argument) |
| 17 | shift |
| 18 | ;; |
| 19 | -vpython*) # delete any vpython-specific flag (w/ separate argument) |
| 20 | shift |
| 21 | shift |
| 22 | ;; |
| 23 | --) # stop parsing |
| 24 | NEWARGS+=( "$@" ) |
| 25 | break |
| 26 | ;; |
| 27 | *) # regular arg |
| 28 | NEWARGS+=( "$1" ) |
| 29 | shift |
| 30 | ;; |
| 31 | esac |
| 32 | done |
| 33 | exec "python3" "${NEWARGS[@]}" |
| 34 | fi |
| 35 | |
| 36 | |
Edward Lemur | bf26b16 | 2019-11-15 22:33:41 +0000 | [diff] [blame^] | 37 | base_dir=$(dirname "$0") |
smut | 447b45d | 2019-07-31 21:26:27 +0000 | [diff] [blame] | 38 | |
Edward Lemur | bf26b16 | 2019-11-15 22:33:41 +0000 | [diff] [blame^] | 39 | source "$base_dir/cipd_bin_setup.sh" |
smut | 447b45d | 2019-07-31 21:26:27 +0000 | [diff] [blame] | 40 | cipd_bin_setup &> /dev/null |
| 41 | |
Edward Lemur | bf26b16 | 2019-11-15 22:33:41 +0000 | [diff] [blame^] | 42 | # If Python bootstrapping is not disabled, make sure Python has been |
| 43 | # bootstrapped and add it to the front of PATH. |
| 44 | if [[ $MINGW != 0 && $DEPOT_TOOLS_BOOTSTRAP_PYTHON3 != 0 ]]; then |
| 45 | if [[ ! -e $base_dir/python3_bin_reldir.txt ]]; then |
| 46 | source "$base_dir/bootstrap_python3" |
| 47 | bootstrap_python3 |
| 48 | fi |
| 49 | PYTHON3_BIN_RELDIR="$base_dir/$(cat $base_dir/python3_bin_reldir.txt | xargs echo)" |
| 50 | PATH="$PYTHON3_BIN_RELDIR":"$PYTHON3_BIN_RELDIR/Scripts":"$PATH" |
| 51 | fi |
Edward Lemur | 9577daf | 2019-11-12 18:05:55 +0000 | [diff] [blame] | 52 | |
Edward Lemur | bf26b16 | 2019-11-15 22:33:41 +0000 | [diff] [blame^] | 53 | exec "$base_dir/.cipd_bin/vpython3" "$@" |