mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 10:41:31 +00:00
setup & share path to depot_tools checkout
A lot of scripts like to compute the dirname of $0 to find itself to load more files. Have some scripts export & resuse this value so we avoid recalculating when not needed. Bug: 1469696 Change-Id: I3aac2e6119dbfa3c68715208df2786f67cdce92e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4750430 Auto-Submit: Mike Frysinger <vapier@chromium.org> Reviewed-by: Josip Sokcevic <sokcevic@chromium.org> Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
This commit is contained in:
5
cipd
5
cipd
@@ -6,7 +6,10 @@
|
||||
|
||||
set -e -o pipefail
|
||||
|
||||
MYPATH=$(dirname "${BASH_SOURCE[0]}")
|
||||
# Export for other depot_tools scripts to re-use.
|
||||
export DEPOT_TOOLS_DIR="${DEPOT_TOOLS_DIR:-$(dirname "${BASH_SOURCE[0]}")}"
|
||||
|
||||
MYPATH="${DEPOT_TOOLS_DIR}"
|
||||
CYGWIN=false
|
||||
|
||||
# Make sure this starts empty
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# found in the LICENSE file.
|
||||
|
||||
function cipd_bin_setup {
|
||||
local MYPATH=$(dirname "${BASH_SOURCE[0]}")
|
||||
local MYPATH="${DEPOT_TOOLS_DIR:-$(dirname "${BASH_SOURCE[0]}")}"
|
||||
local ENSURE="$MYPATH/cipd_manifest.txt"
|
||||
local ROOT="$MYPATH/.cipd_bin"
|
||||
|
||||
|
||||
@@ -14,12 +14,15 @@
|
||||
# invoke this script instead of manually calling "cipd_bin_setup" and other
|
||||
# operations.
|
||||
|
||||
# Export for other depot_tools scripts to re-use.
|
||||
export DEPOT_TOOLS_DIR="${DEPOT_TOOLS_DIR:-$(dirname "${BASH_SOURCE[0]}")}"
|
||||
|
||||
# Test if this script is running under a MinGW install. If it is, we will
|
||||
# hardcode the paths to Git where possible.
|
||||
OUTPUT="$(uname | grep 'MINGW')"
|
||||
MINGW=$?
|
||||
|
||||
base_dir=$(dirname "${BASH_SOURCE[0]}")
|
||||
base_dir="${DEPOT_TOOLS_DIR}"
|
||||
if [ $MINGW != 0 ]; then
|
||||
# Don't bootstrap Python 3 on windows, since it is already done by
|
||||
# bootstrap/win_tools.bat.
|
||||
|
||||
@@ -11,6 +11,9 @@ then
|
||||
exit
|
||||
fi
|
||||
|
||||
# Export for other depot_tools scripts to re-use.
|
||||
export DEPOT_TOOLS_DIR="${DEPOT_TOOLS_DIR:-$(dirname "$0")}"
|
||||
|
||||
# Test if this script is running under a MSYS install. This is likely an error
|
||||
# if it is, so we warn the user accordingly.
|
||||
OUTPUT="$(uname | grep 'MSYS')"
|
||||
@@ -25,7 +28,7 @@ if [ $MSYS = 0 ]; then
|
||||
echo
|
||||
fi
|
||||
|
||||
base_dir=$(dirname "$0")
|
||||
base_dir="${DEPOT_TOOLS_DIR}"
|
||||
if [ -e "$base_dir/.disable_auto_update" ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
8
vpython
8
vpython
@@ -35,10 +35,10 @@ then
|
||||
exec "python" "${NEWARGS[@]}"
|
||||
fi
|
||||
|
||||
# Export for other depot_tools scripts to re-use.
|
||||
export DEPOT_TOOLS_DIR="${DEPOT_TOOLS_DIR:-$(dirname "$0")}"
|
||||
|
||||
base_dir=$(dirname "$0")
|
||||
|
||||
source "$base_dir/cipd_bin_setup.sh"
|
||||
source "${DEPOT_TOOLS_DIR}/cipd_bin_setup.sh"
|
||||
cipd_bin_setup &> /dev/null
|
||||
|
||||
case $(uname -s) in
|
||||
@@ -46,6 +46,6 @@ MINGW*|CYGWIN*)
|
||||
cmd.exe //c $0.bat "$@"
|
||||
;;
|
||||
*)
|
||||
exec "$base_dir/.cipd_bin/vpython" "$@"
|
||||
exec "${DEPOT_TOOLS_DIR}/.cipd_bin/vpython" "$@"
|
||||
;;
|
||||
esac
|
||||
|
||||
8
vpython3
8
vpython3
@@ -33,10 +33,10 @@ then
|
||||
exec "python3" "${NEWARGS[@]}"
|
||||
fi
|
||||
|
||||
# Export for other depot_tools scripts to re-use.
|
||||
export DEPOT_TOOLS_DIR="${DEPOT_TOOLS_DIR:-$(dirname "$0")}"
|
||||
|
||||
base_dir=$(dirname "$0")
|
||||
|
||||
source "$base_dir/cipd_bin_setup.sh"
|
||||
source "${DEPOT_TOOLS_DIR}/cipd_bin_setup.sh"
|
||||
cipd_bin_setup &> /dev/null
|
||||
|
||||
case $(uname -s) in
|
||||
@@ -44,6 +44,6 @@ MINGW*|CYGWIN*)
|
||||
cmd.exe //c $0.bat "$@"
|
||||
;;
|
||||
*)
|
||||
exec "$base_dir/.cipd_bin/vpython3" "$@"
|
||||
exec "${DEPOT_TOOLS_DIR}/.cipd_bin/vpython3" "$@"
|
||||
;;
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user