You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.2 KiB
Bash
37 lines
1.2 KiB
Bash
9 years ago
|
# Copyright 2015 The Chromium Authors. All rights reserved.
|
||
11 years ago
|
# Use of this source code is governed by a BSD-style license that can be
|
||
|
# found in the LICENSE file.
|
||
|
|
||
|
## This file is designed to be sourced from a bash script whose name takes the
|
||
9 years ago
|
## form 'command-name'. This script will then instead invoke
|
||
|
## '[depot_tools]/command_name.py' correctly under mingw as well
|
||
11 years ago
|
## as posix-ey systems, passing along all other command line flags.
|
||
|
|
||
|
## Example:
|
||
9 years ago
|
## echo ". python_runner.sh" > git-foo-command
|
||
11 years ago
|
## ./git-foo-command #=> runs `python git_foo_command.py`
|
||
|
|
||
|
## Constants
|
||
|
PYTHONDONTWRITEBYTECODE=1
|
||
|
|
||
|
## "Input parameters".
|
||
|
# If set before the script is sourced, then we'll use the pre-set values.
|
||
|
#
|
||
|
# SCRIPT defaults to the basename of $0, with dashes replaced with underscores
|
||
|
|
||
9 years ago
|
DEPOT_TOOLS="${0%/*}"
|
||
|
# Sometimes commands will run with no path (e.g. a git command run from within
|
||
|
# the depot_tools dir itself). In that case, treat it like it was run like:
|
||
|
# "./command"
|
||
|
if [[ "$DEPOT_TOOLS" = "$0" ]]; then
|
||
|
DEPOT_TOOLS="."
|
||
11 years ago
|
fi
|
||
9 years ago
|
BASENAME="${0##*/}"
|
||
11 years ago
|
SCRIPT="${SCRIPT-${BASENAME//-/_}.py}"
|
||
|
|
||
|
if [[ -e "$DEPOT_TOOLS/python.bat" && $OSTYPE = msys ]]; then
|
||
|
cmd.exe //c "$DEPOT_TOOLS\\python.bat" "$DEPOT_TOOLS\\$SCRIPT" "$@"
|
||
|
else
|
||
|
exec "$DEPOT_TOOLS/$SCRIPT" "$@"
|
||
|
fi
|