1#!/usr/bin/env python 2#coding=utf-8 3 4# 5# Copyright (c) 2023-2024 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 19import sys 20sys.path.append('.') 21 22from .param.system_parameter_parser import parameters_collect 23from .cfg.config_parser import startup_config_collect 24from .user_group.user_group_parser import create_user_group_parser 25 26 27def __create_arg_parser(): 28 import argparse 29 parser = argparse.ArgumentParser(description='Check startup architecture information from compiled output files.') 30 parser.add_argument('-i', '--input', 31 help='input config files base directory example "out/rk3568/packages/phone/" ', required=True) 32 parser.add_argument('-c', '--target_cpu', 33 help='target_cpu cpu type" ', required=True) 34 return parser 35 36 37class ConfigParserMgr(object): 38 def __init__(self, path=None): 39 self._path = path 40 self._parser_list = {} 41 42 def load_all_parser(self, out_path, target_cpu): 43 cfg_parser = startup_config_collect(out_path, target_cpu) 44 param_parser = parameters_collect(out_path) 45 user_group = create_user_group_parser(out_path) 46 self._parser_list = {'config_parser':cfg_parser, 'system_parameter_parser':param_parser, "user_group":user_group} 47 48 def get_parser_by_name(self, key): 49 if key: 50 return self._parser_list.get(key) 51 52if __name__ == '__main__': 53 args_parser = __create_arg_parser() 54 options = args_parser.parse_args() 55 mgr = ConfigParserMgr() 56 mgr.load_all_parser(options.input, options.target_cpu) 57