From: SangYoun Kwak Date: Mon, 4 Nov 2024 08:57:11 +0000 (+0900) Subject: Modify modify_pc.py script to ignore comments X-Git-Tag: accepted/tizen/unified/20241106.141124~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=63aab3a6d00ebd4564ee62c579f258536a84427b;p=platform%2Fhal%2Fbackend%2Frootstrap.git Modify modify_pc.py script to ignore comments Previously, some line which starts with '#' was not ignored. Consequently, the resulting hal-rootstrap.pc file was modified incorrectly. To solve this issue, modify_pc.py script is modified to ignore lines which start with '#'. Change-Id: I9d71a889412cc64902c853f009c74f12b09f9b52 Signed-off-by: SangYoun Kwak --- diff --git a/modify_pc.py b/modify_pc.py index adea07c..b659456 100755 --- a/modify_pc.py +++ b/modify_pc.py @@ -6,6 +6,7 @@ from re import compile as regex_compile include_dir_root_path = "hal_rootstrap_dir" +regex_comment = regex_compile("([^#]*)(#.*)?") regex_assignment = regex_compile("\\s*([-_a-zA-Z0-9]+)\\s*=\\s*([^\\s]*)") regex_declaration = regex_compile("\\s*([-_a-zA-Z0-9]+)\\s*:\\s*(.+)\\s*") regex_substitution = regex_compile("\\${([-_a-zA-Z0-9]+)}") @@ -14,11 +15,17 @@ libs = { "-L${" + include_dir_root_path + "}" } cflags = { "-I${" + include_dir_root_path + "}" } cxxflags = { "-I${" + include_dir_root_path + "}" } +def remove_comment(line): + matches = regex_comment.findall(line) + line, _ = matches[0][0], matches[0][1] + return line + def parse_pc(fname): variables = dict() f = open(fname, "r") for line in f: + line = remove_comment(line) if matches := regex_assignment.findall(line): symbol, value = matches[0][0], matches[0][1] matched_symbols = regex_substitution.findall(value)