xref: /aosp_15_r20/external/executorch/install_requirements.sh (revision 523fa7a60841cd1ecfb9cc4201f1ca8b03ed023a)
1*523fa7a6SAndroid Build Coastguard Worker#!/bin/bash
2*523fa7a6SAndroid Build Coastguard Worker# Copyright (c) Meta Platforms, Inc. and affiliates.
3*523fa7a6SAndroid Build Coastguard Worker# All rights reserved.
4*523fa7a6SAndroid Build Coastguard Worker#
5*523fa7a6SAndroid Build Coastguard Worker# This source code is licensed under the BSD-style license found in the
6*523fa7a6SAndroid Build Coastguard Worker# LICENSE file in the root directory of this source tree.
7*523fa7a6SAndroid Build Coastguard Worker
8*523fa7a6SAndroid Build Coastguard Worker# Before doing anything, cd to the directory containing this script.
9*523fa7a6SAndroid Build Coastguard Workercd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null || /bin/true
10*523fa7a6SAndroid Build Coastguard Worker
11*523fa7a6SAndroid Build Coastguard Worker# Find the names of the python tools to use.
12*523fa7a6SAndroid Build Coastguard Workerif [[ -z $PYTHON_EXECUTABLE ]];
13*523fa7a6SAndroid Build Coastguard Workerthen
14*523fa7a6SAndroid Build Coastguard Worker  if [[ -z $CONDA_DEFAULT_ENV ]] || [[ $CONDA_DEFAULT_ENV == "base" ]] || [[ ! -x "$(command -v python)" ]];
15*523fa7a6SAndroid Build Coastguard Worker  then
16*523fa7a6SAndroid Build Coastguard Worker    PYTHON_EXECUTABLE=python3
17*523fa7a6SAndroid Build Coastguard Worker  else
18*523fa7a6SAndroid Build Coastguard Worker    PYTHON_EXECUTABLE=python
19*523fa7a6SAndroid Build Coastguard Worker  fi
20*523fa7a6SAndroid Build Coastguard Workerfi
21*523fa7a6SAndroid Build Coastguard Worker
22*523fa7a6SAndroid Build Coastguard Worker$PYTHON_EXECUTABLE ./install_requirements.py "$@"
23*523fa7a6SAndroid Build Coastguard Worker
24*523fa7a6SAndroid Build Coastguard Worker# Exit with the same status as the python script.
25*523fa7a6SAndroid Build Coastguard Workerexit $?
26