8 ENUM_H_REGEXP =
r'^[ ]*(RS2_\w+)' 9 ENUM_CPP_REGEXP =
r'^[ ]*_FORCE_SET_ENUM\((\w+)\)' 10 ENUM_JS_REGEXP =
r'RS2\.(RS2_\w+)' 14 for root, dirs, files
in os.walk(path):
16 if file.endswith(ends):
17 yield os.path.join(root, file)
21 res = re.findall(regexp, line)
30 for file_path
in file_paths:
37 with open(file_path)
as f:
46 def run(include_folder_path, addon_folder_path):
57 return list(set(include_enums) - set(cpp_enums))
60 if __name__ ==
'__main__':
61 parser = argparse.ArgumentParser(description=
'Ping script')
62 parser.add_argument(
'-i', action=
'store', dest=
'include_folder_path', required=
True)
63 parser.add_argument(
'-a', action=
'store', dest=
'addon_folder_path', required=
True)
64 parser.add_argument(
'-v',
'--verbose', action=
'store_true', help=
'print not user enums')
66 args = parser.parse_args()
68 missed =
run(args.include_folder_path, args.addon_folder_path)
72 message =
"[ERROR] Node.js wrapper has missing enum values: %s" % (
', '.
join(missed))
73 sys.exit(message
if args.verbose
else 1)
def get_first_by_regexp(line, regexp)
std::string join(const std::string &base, const std::string &path)
def get_enums_from_folder(folder_path, ends, regexp)
def get_enums_from_file(file_path, regexp)
def run(include_folder_path, addon_folder_path)
def files_gen(path, ends)