From 97acb29117eff344925e5df3848e2cb15b40f2d3 Mon Sep 17 00:00:00 2001 From: lihehe Date: Thu, 8 May 2025 20:39:29 +0800 Subject: [PATCH] bypass permission check if no file to compare Signed-off-by: lihehe Change-Id: I3df3acfbf78fb214bf31c953c544c27efa5561cc --- frameworks/common/permission_check.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/frameworks/common/permission_check.py b/frameworks/common/permission_check.py index 6329269b6..4cbcce5fa 100755 --- a/frameworks/common/permission_check.py +++ b/frameworks/common/permission_check.py @@ -49,6 +49,8 @@ def parse_definition_json(path): def parse_module_json(path): permission_maps = {} + if not os.path.exists(path): + return {} with open(path, "r", encoding="utf-8") as f: data = json.load(f) for perm in data["module"]["definePermissions"]: @@ -107,6 +109,9 @@ if __name__ == "__main__": module_json_path = os.path.join("base/global/system_resources/systemres/main", "module.json") module_json_path = os.path.join(input_args.source_root_dir, module_json_path) module_json_map = parse_module_json(module_json_path) + if not module_json_map: + print("Not found {}, no need to check consistency.".format(module_json_path)) + exit(0) full_permissions_map = parse_definition_json(input_args.input_full_permissions) check_maps(module_json_map, full_permissions_map) print("Check permission consistency pass!") \ No newline at end of file -- Gitee