| 1 | #!/bin/bash |
| 2 | |
| 3 | # Copyright (c) Meta Platforms, Inc. and affiliates. |
| 4 | # All rights reserved. |
| 5 | # |
| 6 | # This source code is licensed under the terms described in the LICENSE file in |
| 7 | # the root directory of this source tree. |
| 8 | |
| 9 | PYTHONPATH=${PYTHONPATH:-} |
| 10 | THIS_DIR="$(cd "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" && pwd)" |
| 11 | |
| 12 | set -euo pipefail |
| 13 | |
| 14 | missing_packages=() |
| 15 | |
| 16 | check_package() { |
| 17 | if ! pip show "$1" &>/dev/null; then |
| 18 | missing_packages+=("$1") |
| 19 | fi |
| 20 | } |
| 21 | |
| 22 | if [ ${#missing_packages[@]} -ne 0 ]; then |
| 23 | echo "Error: The following package(s) are not installed:" |
| 24 | printf " - %s\n" "${missing_packages[@]}" |
| 25 | echo "Please install them using:" |
| 26 | echo "pip install ${missing_packages[*]}" |
| 27 | exit 1 |
| 28 | fi |
| 29 | |
| 30 | stack_dir=$(dirname $(dirname $THIS_DIR)) |
| 31 | models_dir=$(dirname $stack_dir)/llama-models |
| 32 | PYTHONPATH=$PYTHONPATH:$stack_dir:$models_dir python -m docs.openapi_generator.generate $(dirname $THIS_DIR)/resources |