Skip to content

Commit 9c358fc

Browse files
committed
Add install_requirements.{sh,py} that only install requirements
Now that the previous PR renamed install_requirements to install_executorch, we can use those names for scripts that actually just install requirements. ghstack-source-id: 8c1035d ghstack-comment-id: 2597040494 Pull Request resolved: #7715
1 parent eb7fd88 commit 9c358fc

File tree

4 files changed

+65
-16
lines changed

4 files changed

+65
-16
lines changed

install_executorch.sh

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,4 @@
77

88
# Before doing anything, cd to the directory containing this script.
99
cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null || /bin/true
10-
11-
# Find the names of the python tools to use.
12-
if [[ -z $PYTHON_EXECUTABLE ]];
13-
then
14-
if [[ -z $CONDA_DEFAULT_ENV ]] || [[ $CONDA_DEFAULT_ENV == "base" ]] || [[ ! -x "$(command -v python)" ]];
15-
then
16-
PYTHON_EXECUTABLE=python3
17-
else
18-
PYTHON_EXECUTABLE=python
19-
fi
20-
fi
21-
22-
$PYTHON_EXECUTABLE ./install_executorch.py "$@"
23-
24-
# Exit with the same status as the python script.
25-
exit $?
10+
./run_python_script.sh ./install_executorch.py "$@"

install_requirements.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
# Copyright 2024-25 Arm Limited and/or its affiliates.
3+
# All rights reserved.
4+
#
5+
# This source code is licensed under the BSD-style license found in the
6+
# LICENSE file in the root directory of this source tree.
7+
8+
import argparse
9+
import sys
10+
11+
import install_executorch
12+
13+
14+
def main(args):
15+
parser = argparse.ArgumentParser()
16+
parser.add_argument(
17+
"--use-pt-pinned-commit",
18+
action="store_true",
19+
help="build from the pinned PyTorch commit instead of nightly",
20+
)
21+
args = parser.parse_args(args)
22+
install_executorch.install_requirements(
23+
use_pytorch_nightly=not bool(args.use_pt_pinned_commit)
24+
)
25+
26+
27+
if __name__ == "__main__":
28+
main(sys.argv[1:])

install_requirements.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
# Copyright (c) Meta Platforms, Inc. and affiliates.
3+
# All rights reserved.
4+
#
5+
# This source code is licensed under the BSD-style license found in the
6+
# LICENSE file in the root directory of this source tree.
7+
8+
# Before doing anything, cd to the directory containing this script.
9+
cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null || /bin/true
10+
./run_python_script.sh ./install_requirements.py "$@"

run_python_script.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
# Copyright (c) Meta Platforms, Inc. and affiliates.
3+
# All rights reserved.
4+
#
5+
# This source code is licensed under the BSD-style license found in the
6+
# LICENSE file in the root directory of this source tree.
7+
8+
# Before doing anything, cd to the directory containing this script.
9+
cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null || /bin/true
10+
11+
# Find the names of the python tools to use.
12+
if [[ -z $PYTHON_EXECUTABLE ]];
13+
then
14+
if [[ -z $CONDA_DEFAULT_ENV ]] || [[ $CONDA_DEFAULT_ENV == "base" ]] || [[ ! -x "$(command -v python)" ]];
15+
then
16+
PYTHON_EXECUTABLE=python3
17+
else
18+
PYTHON_EXECUTABLE=python
19+
fi
20+
fi
21+
22+
SCRIPT="$1"; shift
23+
$PYTHON_EXECUTABLE $SCRIPT "$@"
24+
25+
# Exit with the same status as the python script.
26+
exit $?

0 commit comments

Comments
 (0)