Robert Nagy | 059f26b | 2019-05-10 14:58:03 +0000 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Sergey Berezin | 6fee267 | 2017-05-01 15:31:16 -0700 | [diff] [blame] | 2 | |
Robert Iannucci | fc40ad2 | 2018-02-20 16:49:12 -0800 | [diff] [blame] | 3 | # Copyright 2018 The Chromium Authors. All rights reserved. |
Sergey Berezin | 6fee267 | 2017-05-01 15:31:16 -0700 | [diff] [blame] | 4 | # Use of this source code is governed by a BSD-style license that can be |
| 5 | # found in the LICENSE file. |
| 6 | |
Nodir Turakulov | 47a4b0b | 2021-05-13 23:58:10 +0000 | [diff] [blame] | 7 | # See revert instructions in cipd_manifest.txt |
| 8 | |
Robert Iannucci | fc40ad2 | 2018-02-20 16:49:12 -0800 | [diff] [blame] | 9 | if [[ $VPYTHON_BYPASS == "manually managed python not supported by chrome operations" ]] |
| 10 | then |
| 11 | NEWARGS=() |
| 12 | while [[ $# -gt 0 ]] |
| 13 | do |
| 14 | case "$1" in |
| 15 | -vpython-tool*) # these tools all do something vpython related and quit |
| 16 | exit 0 |
| 17 | ;; |
| 18 | -vpython*=*) # delete any vpython-specific flag (w/ attached argument) |
| 19 | shift |
| 20 | ;; |
| 21 | -vpython*) # delete any vpython-specific flag (w/ separate argument) |
| 22 | shift |
| 23 | shift |
| 24 | ;; |
| 25 | --) # stop parsing |
| 26 | NEWARGS+=( "$@" ) |
| 27 | break |
| 28 | ;; |
| 29 | *) # regular arg |
| 30 | NEWARGS+=( "$1" ) |
| 31 | shift |
| 32 | ;; |
| 33 | esac |
| 34 | done |
| 35 | exec "python" "${NEWARGS[@]}" |
| 36 | fi |
| 37 | |
Mike Frysinger | 248aa8b | 2023-08-03 22:05:10 +0000 | [diff] [blame] | 38 | # Export for other depot_tools scripts to re-use. |
| 39 | export DEPOT_TOOLS_DIR="${DEPOT_TOOLS_DIR:-$(dirname "$0")}" |
Mike Frysinger | b9b690e | 2023-08-04 18:11:57 +0000 | [diff] [blame] | 40 | export DEPOT_TOOLS_UNAME_S="${DEPOT_TOOLS_UNAME_S:-$(uname -s | tr '[:upper:]' '[:lower:]')}" |
Robert Iannucci | fc40ad2 | 2018-02-20 16:49:12 -0800 | [diff] [blame] | 41 | |
Mike Frysinger | 248aa8b | 2023-08-03 22:05:10 +0000 | [diff] [blame] | 42 | source "${DEPOT_TOOLS_DIR}/cipd_bin_setup.sh" |
Dan Jacques | 5aeeb72 | 2017-07-28 15:22:25 +0200 | [diff] [blame] | 43 | cipd_bin_setup &> /dev/null |
Sergey Berezin | 6fee267 | 2017-05-01 15:31:16 -0700 | [diff] [blame] | 44 | |
Mike Frysinger | f90cc29 | 2023-08-11 15:43:04 +0000 | [diff] [blame] | 45 | # Don't pass this to the Python script as it might turn around and run commands |
| 46 | # in other depot_tools dirs. |
| 47 | base_dir="${DEPOT_TOOLS_DIR}" |
| 48 | unset DEPOT_TOOLS_DIR |
Mike Frysinger | b9b690e | 2023-08-04 18:11:57 +0000 | [diff] [blame] | 49 | case "${DEPOT_TOOLS_UNAME_S}" in |
| 50 | mingw*|cygwin*) |
Mike Frysinger | 5260b2b | 2021-03-30 02:09:47 +0000 | [diff] [blame] | 51 | cmd.exe //c $0.bat "$@" |
Mike Frysinger | 029025a | 2023-08-03 06:58:27 +0000 | [diff] [blame] | 52 | ;; |
| 53 | *) |
Mike Frysinger | f90cc29 | 2023-08-11 15:43:04 +0000 | [diff] [blame] | 54 | exec "${base_dir}/.cipd_bin/vpython" "$@" |
Mike Frysinger | 029025a | 2023-08-03 06:58:27 +0000 | [diff] [blame] | 55 | ;; |
| 56 | esac |