diff --git a/tools/syscap_collector.py b/tools/syscap_collector.py index e60bdc4ffd270ad74cc3ebe43c951ef254dfd16d..cacada4ccc00032b18c892bda6e4f66db3cfb4a1 100755 --- a/tools/syscap_collector.py +++ b/tools/syscap_collector.py @@ -32,6 +32,14 @@ def get_args(): return args +def adjust_syscaps_list(sys_list: list, product: str): + #调整syscaps_list:如果产品属于standard类,则去掉其中以.Lite结尾的syscap + standard_product = ["default", "ipcamera", "pc", "tablet"] + if product in standard_product: + sys_list = [syscap for syscap in sys_list if not syscap.endswith(".Lite")] + return sys_list + + def dict_to_json(output_path: str, syscaps_dict: dict): """ output diff product syscaps json to output path @@ -43,8 +51,10 @@ def dict_to_json(output_path: str, syscaps_dict: dict): flags = os.O_WRONLY | os.O_CREAT modes = stat.S_IWUSR | stat.S_IRUSR for product_name, syscaps_list in syscaps_dict.items(): + syscaps_list = list(set(syscaps_list)) filename = os.path.join(output_path, f'{product_name}.json') with os.fdopen(os.open(filename, flags, modes), 'w') as f: + syscaps_list = adjust_syscaps_list(syscaps_list, product_name) json.dump({'SysCaps': syscaps_list}, f, indent=4) print("end...")