13f085823Sopenharmony_ci#!/bin/bash
23f085823Sopenharmony_ci#
33f085823Sopenharmony_ci# Copyright (c) 2020 Huawei Device Co., Ltd.
43f085823Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
53f085823Sopenharmony_ci# you may not use this file except in compliance with the License.
63f085823Sopenharmony_ci# You may obtain a copy of the License at
73f085823Sopenharmony_ci#
83f085823Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
93f085823Sopenharmony_ci#
103f085823Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
113f085823Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
123f085823Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
133f085823Sopenharmony_ci# See the License for the specific language governing permissions and
143f085823Sopenharmony_ci# limitations under the License.
153f085823Sopenharmony_ci#
163f085823Sopenharmony_ciset -e
173f085823Sopenharmony_ci
183f085823Sopenharmony_ciecho "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
193f085823Sopenharmony_cidate +%F' '%H:%M:%S
203f085823Sopenharmony_ciecho $@
213f085823Sopenharmony_ci
223f085823Sopenharmony_ciBASE_HOME=$(cd $(dirname $0);pwd)
233f085823Sopenharmony_ciRET=0
243f085823Sopenharmony_ci
253f085823Sopenharmony_cido_make()
263f085823Sopenharmony_ci{
273f085823Sopenharmony_ci    pushd ${BASE_HOME}/src
283f085823Sopenharmony_ci        if [[ -f "${BASE_HOME}/python/bin/python3" ]]; then
293f085823Sopenharmony_ci            python_filepath="${BASE_HOME}/python/bin/python3"
303f085823Sopenharmony_ci        elif [[ -f "${BASE_HOME}/../../prebuilts/python/linux-x86/3.8.5/bin/python3" ]]; then
313f085823Sopenharmony_ci            python_filepath="${BASE_HOME}/../../prebuilts/python/linux-x86/3.8.5/bin/python3"
323f085823Sopenharmony_ci        else
333f085823Sopenharmony_ci            python_filepath="python3"
343f085823Sopenharmony_ci        fi
353f085823Sopenharmony_ci
363f085823Sopenharmony_ci        ${python_filepath} -m main "$@"
373f085823Sopenharmony_ci        if [ "$?" != 0 ]; then
383f085823Sopenharmony_ci            echo "main failed!"
393f085823Sopenharmony_ci            $RET=1
403f085823Sopenharmony_ci        fi
413f085823Sopenharmony_ci    popd
423f085823Sopenharmony_ci}
433f085823Sopenharmony_ci
443f085823Sopenharmony_cimain()
453f085823Sopenharmony_ci{
463f085823Sopenharmony_ci    do_make "$@"
473f085823Sopenharmony_ci    exit $RET
483f085823Sopenharmony_ci}
493f085823Sopenharmony_ci
503f085823Sopenharmony_cimain "$@"
513f085823Sopenharmony_ci
523f085823Sopenharmony_cidate +%F' '%H:%M:%S
533f085823Sopenharmony_ciecho "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
54