blob: 9fa1f5f40ddd782d3e013ce6d1957128767730df [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
John Stiles11f4a842020-03-30 17:28:53 +00006 cd "${base_dir}"
Edward Lemur24995252019-09-18 18:31:07 +00007
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.
Yngve Pettersenf7b9e702023-04-26 20:07:56 +000028 "./cipd" ensure -log-level warning -ensure-file "${CIPD_MANIFEST}" \
Edward Lemur24995252019-09-18 18:31:07 +000029 -root "$BOOTSTRAP_PATH"
30
31 BOOTSTRAP_PYTHON_BIN="${BOOTSTRAP_PATH}/python3/bin/python3"
John Stiles11f4a842020-03-30 17:28:53 +000032 "$BOOTSTRAP_PYTHON_BIN" "bootstrap/bootstrap.py" --bootstrap-name "$BOOTSTRAP_PATH"
Edward Lemur24995252019-09-18 18:31:07 +000033
34 cd - > /dev/null
35}