[Tizen] Add prelauncher
[platform/framework/web/crosswalk-tizen.git] / vendor / depot_tools / python_git_runner.sh
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 ## This file is designed to be sourced from a bash script whose name takes the
6 ## form 'git-sub-command'. This script will then instead invoke
7 ## '[depot_tools]/git_sub_command.py' correctly under mingw as well
8 ## as posix-ey systems, passing along all other command line flags.
9
10 ## Example:
11 ## echo ". python_git_runner.sh" > git-foo-command
12 ## ./git-foo-command  #=> runs `python git_foo_command.py`
13
14 ## Constants
15 PYTHONDONTWRITEBYTECODE=1
16
17 ## "Input parameters".
18 # If set before the script is sourced, then we'll use the pre-set values.
19 #
20 # SCRIPT defaults to the basename of $0, with dashes replaced with underscores
21
22 if [[ $OSTYPE = msys ]]
23 then
24   DEPOT_TOOLS="${0%\\*}"
25   BASENAME="${0##*\\}"
26 else
27   DEPOT_TOOLS="${0%/*}"
28   BASENAME="${0##*/}"
29 fi
30 SCRIPT="${SCRIPT-${BASENAME//-/_}.py}"
31
32 if [[ -e "$DEPOT_TOOLS/python.bat" && $OSTYPE = msys ]]; then
33   cmd.exe //c "$DEPOT_TOOLS\\python.bat" "$DEPOT_TOOLS\\$SCRIPT" "$@"
34 else
35   exec "$DEPOT_TOOLS/$SCRIPT" "$@"
36 fi