1#!/usr/bin/env python 2#coding=utf-8 3 4# 5# Copyright (c) 2023 Huawei Device Co., Ltd. 6# Licensed under the Apache License, Version 2.0 (the "License"); 7# you may not use this file except in compliance with the License. 8# You may obtain a copy of the License at 9# 10# http://www.apache.org/licenses/LICENSE-2.0 11# 12# Unless required by applicable law or agreed to in writing, software 13# distributed under the License is distributed on an "AS IS" BASIS, 14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15# See the License for the specific language governing permissions and 16# limitations under the License. 17# 18 19from config_parser_mgr import ConfigParserMgr 20 21def __create_arg_parser(): 22 import argparse 23 parser = argparse.ArgumentParser(description='Check startup architecture information from compiled output files.') 24 parser.add_argument('-i', '--input', 25 help='input config files base directory example "out/rk3568" ', required=True) 26 parser.add_argument('-r', '--rules', action='append', 27 help='rules directory', required=False) 28 parser.add_argument('-n', '--no_fail', 29 help='force to pass all rules', required=False) 30 return parser 31 32def startup_guard(out_path, args=None): 33 mgr = ConfigParserMgr() 34 mgr.load_all_parser(out_path) 35 36 from startup_checker import check_all_rules 37 passed = check_all_rules(mgr, args) 38 if passed: 39 print("All rules passed") 40 else: 41 print("Please modify according to README.md") 42 43if __name__ == '__main__': 44 parser = __create_arg_parser() 45 args = parser.parse_args() 46 startup_guard(args.input, args) 47