vpython3 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/usr/bin/env bash
  2. # Copyright 2019 The Chromium Authors. All rights reserved.
  3. # Use of this source code is governed by a BSD-style license that can be
  4. # found in the LICENSE file.
  5. if [[ $VPYTHON_BYPASS == "manually managed python not supported by chrome operations" ]]
  6. then
  7. NEWARGS=()
  8. while [[ $# -gt 0 ]]
  9. do
  10. case "$1" in
  11. -vpython-tool*) # these tools all do something vpython related and quit
  12. exit 0
  13. ;;
  14. -vpython*=*) # delete any vpython-specific flag (w/ attached argument)
  15. shift
  16. ;;
  17. -vpython*) # delete any vpython-specific flag (w/ separate argument)
  18. shift
  19. shift
  20. ;;
  21. --) # stop parsing
  22. NEWARGS+=( "$@" )
  23. break
  24. ;;
  25. *) # regular arg
  26. NEWARGS+=( "$1" )
  27. shift
  28. ;;
  29. esac
  30. done
  31. exec "python3" "${NEWARGS[@]}"
  32. fi
  33. # Export for other depot_tools scripts to re-use.
  34. export DEPOT_TOOLS_DIR="${DEPOT_TOOLS_DIR:-$(dirname "$0")}"
  35. export DEPOT_TOOLS_UNAME_S="${DEPOT_TOOLS_UNAME_S:-$(uname -s | tr '[:upper:]' '[:lower:]')}"
  36. source "${DEPOT_TOOLS_DIR}/cipd_bin_setup.sh"
  37. CIPD_ROOT=$(cipd_bin_setup) &> /dev/null
  38. # Don't pass this to the Python script as it might turn around and run commands
  39. # in other depot_tools dirs.
  40. base_dir="${DEPOT_TOOLS_DIR}"
  41. unset DEPOT_TOOLS_DIR
  42. case "${DEPOT_TOOLS_UNAME_S}" in
  43. mingw*|cygwin*)
  44. cmd.exe //c $0.bat "$@"
  45. ;;
  46. *)
  47. exec "$CIPD_ROOT/vpython3" "$@"
  48. ;;
  49. esac