bootstrap_python3 984 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/usr/bin/env bash
  2. function bootstrap_python3 {
  3. base_dir=$(dirname "${BASH_SOURCE[0]}")
  4. cd "${base_dir}"
  5. if [ -e ".bleeding_edge" ]; then
  6. CIPD_MANIFEST="bootstrap/manifest_bleeding_edge.txt"
  7. else
  8. CIPD_MANIFEST="bootstrap/manifest.txt"
  9. fi
  10. while IFS= read -r line; do
  11. if [[ $line =~ ^[^#].*cpython3/.*version:(.*)$ ]]; then
  12. PYTHON3_VERSION=${BASH_REMATCH[1]}
  13. PYTHON3_VERSION=${PYTHON3_VERSION//[[:space:]]/}
  14. fi
  15. done < $CIPD_MANIFEST
  16. if [ "X$PYTHON3_VERSION" == "X" ]; then
  17. echo Could not extract Python 3 version from manifest.
  18. return 1
  19. fi
  20. BOOTSTRAP_PATH="bootstrap-${PYTHON3_VERSION}_bin"
  21. # Install CIPD packages. The CIPD client self-bootstraps.
  22. "./cipd" ensure -log-level warning -ensure-file "${CIPD_MANIFEST}" \
  23. -root "$BOOTSTRAP_PATH"
  24. BOOTSTRAP_PYTHON_BIN="${BOOTSTRAP_PATH}/python3/bin/python3"
  25. "$BOOTSTRAP_PYTHON_BIN" "bootstrap/bootstrap.py" --bootstrap-name "$BOOTSTRAP_PATH"
  26. cd - > /dev/null
  27. }