#!/bin/bash

set -e
set -o pipefail

if [ -z "$PYTHON_BIN_PATH" ]; then
  PYTHON_BIN_PATH=$(which python3 || which python || true)
fi

TORCHAIR_ROOT=$(cd "$(dirname $0)"; pwd)
config_file=${TORCHAIR_ROOT}/tools/TORCH_VERSION

if [ ! -f config_file ]; then
   # Set all env variables
   CONFIGURE_DIR=$(dirname "$0")
   "$PYTHON_BIN_PATH" "${CONFIGURE_DIR}/configure.py" "$@"
fi

echo "Configuration finished"