Skip to content

Commit 7efc5cb

Browse files
committed
👷 Minor signature.py adjustments
1 parent 11ea940 commit 7efc5cb

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

buildroot/share/PlatformIO/scripts/signature.py

+7-9
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ def enabled_defines(filepath):
1818
Each entry is a dictionary with a 'name' and a 'section' key. We end up with:
1919
{ MOTHERBOARD: { name: "MOTHERBOARD", section: "hardware" }, ... }
2020
21-
The 'name' key might get dropped as redundant, but it's useful for debugging.
21+
TODO: Drop the 'name' key as redundant. For now it's useful for debugging.
2222
23-
Because the option names are the keys, only the last occurrence is retained.
24-
Use the Schema class for a more complete list of options, soon with full parsing.
23+
This list is only used to filter config-defined options from those defined elsewhere.
2524
26-
This list is used to filter what is actually a config-defined option versus
27-
defines from elsewhere.
25+
Because the option names are the keys, only the last occurrence is retained.
26+
This means the actual used value might not be reflected by this function.
27+
The Schema class does more complete parsing for a more accurate list of options.
2828
2929
While the Schema class parses the configurations on its own, this script will
3030
get the preprocessor output and get the intersection of the enabled options from
@@ -44,13 +44,10 @@ def enabled_defines(filepath):
4444
# This will avoid false positives from #defines in comments
4545
f = re.sub(r'/\*.*?\*/', '', '\n'.join(f), flags=re.DOTALL).split("\n")
4646

47-
a = []
4847
for line in f:
4948
sline = line.strip()
5049
m = re.match(spatt, sline) # @section ...
51-
if m:
52-
section = m.group(1).strip()
53-
continue
50+
if m: section = m.group(1).strip() ; continue
5451
if sline[:7] == "#define":
5552
# Extract the key here (we don't care about the value)
5653
kv = sline[8:].strip().split()
@@ -79,6 +76,7 @@ def compute_build_signature(env):
7976
Compute the build signature by extracting all configuration settings and
8077
building a unique reversible signature that can be included in the binary.
8178
The signature can be reversed to get a 1:1 equivalent configuration file.
79+
Used by common-dependencies.py after filtering build files by feature.
8280
'''
8381
if 'BUILD_SIGNATURE' in env: return
8482
env.Append(BUILD_SIGNATURE=1)

0 commit comments

Comments
 (0)