Tools: extract_features.py: sort extracted features string into more useful order

when taking differences between output of this file it is more useful to sort the list regardless of compiled-in/compiled-out.
This commit is contained in:
Peter Barker 2023-07-31 12:38:34 +10:00 committed by Peter Barker
parent 9d768c0843
commit 3784841eaa
1 changed files with 13 additions and 4 deletions

View File

@ -378,11 +378,20 @@ class ExtractFeatures(object):
ret = ""
for compiled_in_feature_define in sorted(compiled_in_feature_defines):
ret += compiled_in_feature_define + "\n"
for remaining in sorted(not_compiled_in_feature_defines):
ret += "!" + remaining + "\n"
combined = {}
for define in sorted(compiled_in_feature_defines):
combined[define] = True
for define in sorted(not_compiled_in_feature_defines):
combined[define] = False
def squash_hal_to_ap(a):
return re.sub("^HAL_", "AP_", a)
for define in sorted(combined.keys(), key=squash_hal_to_ap):
bang = ""
if not combined[define]:
bang = "!"
ret += bang + define + "\n"
return ret
def run(self):