vpython 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. base_dir=$(dirname "$0")
  35. source "$base_dir/cipd_bin_setup.sh"
  36. cipd_bin_setup &> /dev/null
  37. echo $@ from $(pwd) >> "$base_dir/python2_usage.txt"
  38. # If Python bootstrapping is not disabled, make sure Python has been
  39. # bootstrapped and add it to the front of PATH.
  40. if [[ $(uname -s) = MINGW* || $(uname -s) = CYGWIN* ]]; then
  41. cmd.exe //c $0.bat "$@"
  42. elif [[ $DEPOT_TOOLS_BOOTSTRAP_PYTHON3 != 0 ]]; then
  43. if [[ ! -e "$base_dir/python_bin_reldir.txt" ]]; then
  44. source "$base_dir/bootstrap_python3"
  45. bootstrap_python3
  46. fi
  47. exec "$base_dir/.cipd_bin/vpython" "$@"
  48. else
  49. exec "$base_dir/.cipd_bin/vpython" "$@"
  50. fi