ensure_bootstrap 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/usr/bin/env bash
  2. # Copyright 2017 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. # This is a shell script to ensure that all of the "depot_tools" bootstrap
  6. # programs are locally downloaded and ready for execution.
  7. #
  8. # Unlike "update_depot_tools", this script works with the current
  9. # checkout, and will not update/sync the "depot_tools" repository.
  10. #
  11. # TODO: This duplicates logic in "update_depot_tools". Update that script to
  12. # invoke this script instead of manually calling "cipd_bin_setup" and other
  13. # operations.
  14. # Test if this script is running under a MinGW install. If it is, we will
  15. # hardcode the paths to Git where possible.
  16. OUTPUT="$(uname | grep 'MINGW')"
  17. MINGW=$?
  18. if [ $MINGW = 0 ]; then
  19. base_dir="${0%/*}"
  20. else
  21. base_dir=$(dirname "${BASH_SOURCE[0]}")
  22. if [ -L "$base_dir" ]; then
  23. base_dir=`cd "$base_dir" && pwd -P`
  24. fi
  25. # Don't bootstrap Python 3 on windows, since it is already done by
  26. # bootstrap/win_tools.bat.
  27. if [ "X$DEPOT_TOOLS_BOOTSTRAP_PYTHON3" != "X0" ]; then
  28. source "$base_dir/bootstrap_python3"
  29. bootstrap_python3
  30. fi
  31. fi
  32. # Sync CIPD-boostrapped packages.
  33. source "$base_dir/cipd_bin_setup.sh"
  34. cipd_bin_setup
  35. # Sync "gsutil.py".
  36. python "$base_dir/gsutil.py" -- version 1> /dev/null
  37. # Sync all the pylint versions.
  38. for script in "$base_dir"/pylint-[0-9].[0-9]; do
  39. # We have to silence stderr too because newer pylint versions will emit
  40. # a spurious log to tell us what pylintrc file it's using. Ugh.
  41. "$script" --version >/dev/null 2>&1
  42. done
  43. # Cleanup.
  44. find "$base_dir" -iname "*.pyc" -delete || true