• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3"""
4Copyright (c) 2020-2021 Huawei Device Co., Ltd.
5Licensed under the Apache License, Version 2.0 (the "License");
6you may not use this file except in compliance with the License.
7You may obtain a copy of the License at
8
9  http://www.apache.org/licenses/LICENSE-2.0
10
11Unless required by applicable law or agreed to in writing, software
12distributed under the License is distributed on an "AS IS" BASIS,
13WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14See the License for the specific language governing permissions and
15limitations under the License.
16"""
17
18import os
19import fnmatch
20import sys
21import argparse
22import distutils.dir_util as dir_util
23import distutils.file_util as file_util
24import json
25import subprocess
26
27def get_modulename_by_buildtarget(module_list_file, build_target):
28    if not os.path.exists(module_list_file):
29        return ""
30    module_info_data = {}
31    with open(module_list_file, "r") as module_file:
32        module_info_data = json.load(module_file)
33    for module in module_info_data:
34        if module in [build_target, f'{build_target}_override']:
35            return module_info_data[module];
36    return ""
37
38if __name__ == '__main__':
39    global_parts_info = sys.argv[1]
40    tmp_subsystem_part = sys.argv[2]
41    method = sys.argv[3]
42    if method == "judgePart":
43      res = get_modulename_by_buildtarget(global_parts_info,tmp_subsystem_part)
44      sys.stdout.write(str(res))
45    else:
46      sys.stdout.write("test")