!410 syscap collect的输出结果去重及标准产品去掉.Lite结尾的syscap

Merge pull request !410 from flying/master
This commit is contained in:
openharmony_ci
2024-02-22 15:32:32 +00:00
committed by Gitee
+10
View File
@@ -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...")