#!/bin/bash
# -----------------------------------------------------------------------------------------------------------
# Copyright (c) 2026 Huawei Technologies Co., Ltd.
# This program is free software, you can redistribute it and/or modify it under the terms and conditions of
# CANN Open Software License Agreement Version 2.0 (the "License").
# Please refer to the License for details. You may not use this file except in compliance with the License.
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
# See LICENSE in the root of the software repository for the full text of the License.
# -----------------------------------------------------------------------------------------------------------
real_path=$(realpath "$0")
LOCAL_PATH=$(cd "$(dirname "$real_path")"; pwd)
PKG_PATH=$(cd "${LOCAL_PATH}/.."; pwd)
LIB64_PATH="${PKG_PATH}/lib64"
PYTHON_PATH="${PKG_PATH}/python/site-packages"
export LD_LIBRARY_PATH="${LIB64_PATH}:${LD_LIBRARY_PATH}"
export PYTHONPATH="${PYTHON_PATH}:${PYTHONPATH}"
exec "${PYTHON:-python3}" -c 'import sys; from ge.pyatc.__main__ import main; main(sys.argv[1], sys.argv[2:])' \
"${real_path}" "$@"