vpython 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/usr/bin/env bash
  2. # Copyright 2018 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. # See revert instructions in cipd_manifest.txt
  6. if [[ $VPYTHON_BYPASS == "manually managed python not supported by chrome operations" ]]
  7. then
  8. NEWARGS=()
  9. while [[ $# -gt 0 ]]
  10. do
  11. case "$1" in
  12. -vpython-tool*) # these tools all do something vpython related and quit
  13. exit 0
  14. ;;
  15. -vpython*=*) # delete any vpython-specific flag (w/ attached argument)
  16. shift
  17. ;;
  18. -vpython*) # delete any vpython-specific flag (w/ separate argument)
  19. shift
  20. shift
  21. ;;
  22. --) # stop parsing
  23. NEWARGS+=( "$@" )
  24. break
  25. ;;
  26. *) # regular arg
  27. NEWARGS+=( "$1" )
  28. shift
  29. ;;
  30. esac
  31. done
  32. exec "python" "${NEWARGS[@]}"
  33. fi
  34. # Export for other depot_tools scripts to re-use.
  35. export DEPOT_TOOLS_DIR="${DEPOT_TOOLS_DIR:-$(dirname "$0")}"
  36. export DEPOT_TOOLS_UNAME_S="${DEPOT_TOOLS_UNAME_S:-$(uname -s | tr '[:upper:]' '[:lower:]')}"
  37. source "${DEPOT_TOOLS_DIR}/cipd_bin_setup.sh"
  38. cipd_bin_setup &> /dev/null
  39. # Don't pass this to the Python script as it might turn around and run commands
  40. # in other depot_tools dirs.
  41. base_dir="${DEPOT_TOOLS_DIR}"
  42. unset DEPOT_TOOLS_DIR
  43. case "${DEPOT_TOOLS_UNAME_S}" in
  44. mingw*|cygwin*)
  45. cmd.exe //c $0.bat "$@"
  46. ;;
  47. *)
  48. exec "${base_dir}/.cipd_bin/vpython" "$@"
  49. ;;
  50. esac