• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3# Copyright (c) 2021 Huawei Device Co., Ltd.
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16import sys
17import os
18import argparse
19
20sys.path.append(
21    os.path.dirname(os.path.dirname(os.path.dirname(
22        os.path.abspath(__file__)))))
23from scripts.util.file_utils import write_json_file  # noqa: E402
24
25
26def _generate_info_file(part_name, target_label, sa_info_files,
27                        out_info_file):
28    info = {
29        'part_name': part_name,
30        'label': target_label,
31        'sa_info_files': sa_info_files
32    }
33    write_json_file(out_info_file, info)
34
35
36def main():
37    parser = argparse.ArgumentParser()
38    parser.add_argument('--sa-input-files', nargs='+', required=True)
39    parser.add_argument('--target-label', required=True)
40    parser.add_argument('--output-module-info-file', required=True)
41    parser.add_argument('--part-name', required=True)
42    args = parser.parse_args()
43    _generate_info_file(args.part_name, args.target_label,
44                        args.sa_input_files, args.output_module_info_file)
45    return 0
46
47
48if __name__ == '__main__':
49    sys.exit(main())
50