This tool intends to help this tremendous work.
+Installing
+----------
+
+You may need to install 'python3-asteval' for the 'asteval' module.
Usage
-----
"""
pattern = re.compile(r'^\s*#\s*if.*$\n^\s*#\s*endif.*$\n*', flags=re.M)
with open(header_path) as f:
- data = f.read()
+ try:
+ data = f.read()
+ except UnicodeDecodeError as e:
+ print("Failed on file %s': %s" % (header_path, e))
+ return
new_data = pattern.sub('\n', data)
options: option flags.
"""
with open(header_path) as f:
- lines = f.readlines()
+ try:
+ lines = f.readlines()
+ except UnicodeDecodeError as e:
+ print("Failed on file %s': %s" % (header_path, e))
+ return
matched = []
for i, line in enumerate(lines):