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