blob: 55fd4aadc9423546a526d4831f86c29aa9f0fe1e [file] [log] [blame]
Robert Nagy059f26b2019-05-10 14:58:03 +00001#!/usr/bin/env bash
Sergey Berezin6fee2672017-05-01 15:31:16 -07002
Robert Iannuccifc40ad22018-02-20 16:49:12 -08003# Copyright 2018 The Chromium Authors. All rights reserved.
Sergey Berezin6fee2672017-05-01 15:31:16 -07004# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
Nodir Turakulov47a4b0b2021-05-13 23:58:10 +00007# See revert instructions in cipd_manifest.txt
8
Robert Iannuccifc40ad22018-02-20 16:49:12 -08009if [[ $VPYTHON_BYPASS == "manually managed python not supported by chrome operations" ]]
10then
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[@]}"
36fi
37
Mike Frysinger248aa8b2023-08-03 22:05:10 +000038# Export for other depot_tools scripts to re-use.
39export DEPOT_TOOLS_DIR="${DEPOT_TOOLS_DIR:-$(dirname "$0")}"
Mike Frysingerb9b690e2023-08-04 18:11:57 +000040export DEPOT_TOOLS_UNAME_S="${DEPOT_TOOLS_UNAME_S:-$(uname -s | tr '[:upper:]' '[:lower:]')}"
Robert Iannuccifc40ad22018-02-20 16:49:12 -080041
Mike Frysinger248aa8b2023-08-03 22:05:10 +000042source "${DEPOT_TOOLS_DIR}/cipd_bin_setup.sh"
Dan Jacques5aeeb722017-07-28 15:22:25 +020043cipd_bin_setup &> /dev/null
Sergey Berezin6fee2672017-05-01 15:31:16 -070044
Mike Frysingerf90cc292023-08-11 15:43:04 +000045# Don't pass this to the Python script as it might turn around and run commands
46# in other depot_tools dirs.
47base_dir="${DEPOT_TOOLS_DIR}"
48unset DEPOT_TOOLS_DIR
Mike Frysingerb9b690e2023-08-04 18:11:57 +000049case "${DEPOT_TOOLS_UNAME_S}" in
50mingw*|cygwin*)
Mike Frysinger5260b2b2021-03-30 02:09:47 +000051 cmd.exe //c $0.bat "$@"
Mike Frysinger029025a2023-08-03 06:58:27 +000052 ;;
53*)
Mike Frysingerf90cc292023-08-11 15:43:04 +000054 exec "${base_dir}/.cipd_bin/vpython" "$@"
Mike Frysinger029025a2023-08-03 06:58:27 +000055 ;;
56esac