• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
19import sys
20sys.path.append('.')
21
22from .param.system_parameter_parser import parameters_collect
23from .cfg.config_parser import startup_config_collect
24
25def __create_arg_parser():
26    import argparse
27    parser = argparse.ArgumentParser(description='Check startup architecture information from compiled output files.')
28    parser.add_argument('-i', '--input',
29                        help='input config files base directory example "out/rk3568/packages/phone/" ', required=True)
30    return parser
31
32class ConfigParserMgr(object):
33    def __init__(self, path = None):
34        self._path = path
35        self._parser_list = {}
36
37    def load_all_parser(self, options):
38        cfg_parser = startup_config_collect(options)
39        param_parser = parameters_collect(options)
40        self._parser_list = {'cmd_whitelist':cfg_parser, 'system_parameter_whitelist':param_parser}
41
42    def get_parser_by_name(self, key):
43        if key:
44            return self._parser_list[key]
45
46if __name__ == '__main__':
47    args_parser = __create_arg_parser()
48    options = args_parser.parse_args()
49    mgr = ConfigParserMgr()
50    mgr.load_all_parser(options)
51