blob: 7c0f602007421864f63d1e0e58ac37f4c17d0f8d [file] [log] [blame]
#!/usr/bin/env bash
# Copyright 2018 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Installs or updates prebuilt tools.
set -o errexit
set -o pipefail
script_root="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd)"
"${script_root}/cipd.py" ensure \
-ensure-file "${script_root}/cipd.ensure" \
-root "${script_root}" \
-log-level warning
# Write vpython3 wrapper. The gLinux version of Python 3.8 is broken, so we need
# to make sure that vpython uses the custom Chromium version of Python from
# CIPD.
# TODO(crbug.com/1176014): Assuming gLinux Python 3.9 doesn't have the same
# issues as 3.8, this will likely no longer be necessary once vpython supports
# Python 3.9. At that point we can delete this shim and go back to running
# vpython3 directly.
echo '#!/usr/bin/env bash
tools_dir="$(dirname "$0")"
exec "${tools_dir}/vpython_upstream/vpython3" -vpython-interpreter "${tools_dir}/python3/bin/python3" "$@"
' > "${script_root}/tools/vpython3"
# Write vpython wrapper. This is only necessary because vpython and vpython3 are
# in the same CIPD package, so if we nest vpython3 in a subdirectory of "tools"
# then we need to do the same for vpython.
echo '#!/usr/bin/env bash
tools_dir="$(dirname "$0")"
exec "${tools_dir}/vpython_upstream/vpython" "$@"
' > "${script_root}/tools/vpython"
chmod +x "${script_root}/tools/vpython"
chmod +x "${script_root}/tools/vpython3"