raiseException('{} at {}:{} has default value {} which isn\'t in list of enumvalues {}'.format(config_name,file_path,linenum,config_attrs['default'],config_attrs['enumvalues']))
else:
raiseException("Found unknown PICO_CONFIG type {} at {}:{}".format(_type,file_path,linenum))
# Scan all .c and .h files in the specific path, recursively.
fordirpath,dirnames,filenamesinos.walk(scandir):
forfilenameinfilenames:
file_ext=os.path.splitext(filename)[1]
iffile_extin('.c','.h'):
file_path=os.path.join(dirpath,filename)
withopen(file_path,encoding="ISO-8859-1")asfh:
linenum=0
forlineinfh.readlines():
linenum+=1
line=line.strip()
m=CONFIG_RE.match(line)
ifm:
config_name=m.group(1)
config_description=m.group(2)
_attrs=m.group(3)
# allow commas to appear inside brackets by converting them to and from NULL chars
raiseException("For {} at {}:{} the description was set to '{}' - has the description field been omitted?".format(config_name,file_path,linenum,config_description))
ifconfig_descriptioninall_descriptions:
raiseException("Found description {} at {}:{} but it was already used at {}:{}".format(config_description,file_path,linenum,os.path.join(scandir,all_descriptions[config_description]['filename']),all_descriptions[config_description]['line_number']))
raiseException('{} at {}:{} has no group attribute'.format(config_name,file_path,linenum))
#print(file_path, config_name, config_attrs)
ifconfig_nameinall_configs:
raiseException("Found {} at {}:{} but it was already declared at {}:{}".format(config_name,file_path,linenum,os.path.join(scandir,all_configs[config_name]['filename']),all_configs[config_name]['line_number']))
raiseException('Found {} at {}:{} with a default of {}, but #define says {} (at {}:{})'.format(config_name,os.path.join(scandir,all_configs[config_name]['filename']),all_configs[config_name]['line_number'],all_configs[config_name]['attrs']['default'],first_define_value,all_defines[config_name][first_define_value][0],all_defines[config_name][first_define_value][1]))
else:
raiseException('Found {} at {}:{} with a default of {}, but no matching #define found'.format(config_name,os.path.join(scandir,all_configs[config_name]['filename']),all_configs[config_name]['line_number'],all_configs[config_name]['attrs']['default']))