lv_conf_checker.py: support macros with parentheses

This commit is contained in:
Gabor Kiss-Vamosi
2019-10-11 15:03:12 +02:00
parent 7325a3cdde
commit bae1cb6ae0

6
scripts/lv_conf_checker.py Normal file → Executable file
View File

@@ -1,3 +1,5 @@
#!/usr/bin/env python3.6
''' '''
Generates a checker file for lv_conf.h from lv_conf_templ.h define all the not defined values Generates a checker file for lv_conf.h from lv_conf_templ.h define all the not defined values
''' '''
@@ -34,9 +36,11 @@ for i in fin.read().splitlines():
if '/*--END OF LV_CONF_H--*/' in i: break if '/*--END OF LV_CONF_H--*/' in i: break
r = re.search(r'^ *# *define ([^\s]+).*$', i) r = re.search(r'^ *# *define ([^\s]+).*$', i)
if r: if r:
line = re.sub('\(.*?\)', '', r[1], 1) #remove parentheses from macros
fout.write( fout.write(
f'#ifndef {r[1]}\n' f'#ifndef {line}\n'
f'{i}\n' f'{i}\n'
'#endif\n' '#endif\n'
) )