Skip to content

Commit 7603023

Browse files
committed
🔨 Apply signature.py help
1 parent dbf81f4 commit 7603023

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

buildroot/share/PlatformIO/scripts/signature.py

+30-30
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,32 @@
88
from datetime import datetime
99
from pathlib import Path
1010

11-
'''
12-
Return all enabled #define items from a given C header file in a dictionary.
13-
A "#define" in a multi-line comment could produce a false positive if it's not
14-
preceded by a non-space character (like * in a multi-line comment).
15-
16-
Output:
17-
Each entry is a dictionary with a 'name' and a 'section' key. We end up with:
18-
{ MOTHERBOARD: { name: "MOTHERBOARD", section: "hardware" }, ... }
19-
20-
The 'name' key might get dropped as redundant, but it's useful for debugging.
21-
22-
Because the option names are the keys, only the last occurrence is retained.
23-
Use the Schema class for a more complete list of options, soon with full parsing.
24-
25-
This list is used to filter what is actually a config-defined option versus
26-
defines from elsewhere.
27-
28-
While the Schema class parses the configurations on its own, this script will
29-
get the preprocessor output and get the intersection of the enabled options from
30-
our crude scraping method and the actual compiler output.
31-
We end up with the actual configured state,
32-
better than what the config files say. You can then use the
33-
a decent reflection of all enabled options that (probably) came from
34-
resulting config.ini to produce more exact configuration files.
35-
'''
3611
def enabled_defines(filepath):
12+
'''
13+
Return all enabled #define items from a given C header file in a dictionary.
14+
A "#define" in a multi-line comment could produce a false positive if it's not
15+
preceded by a non-space character (like * in a multi-line comment).
16+
17+
Output:
18+
Each entry is a dictionary with a 'name' and a 'section' key. We end up with:
19+
{ MOTHERBOARD: { name: "MOTHERBOARD", section: "hardware" }, ... }
20+
21+
The 'name' key might get dropped as redundant, but it's useful for debugging.
22+
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.
25+
26+
This list is used to filter what is actually a config-defined option versus
27+
defines from elsewhere.
28+
29+
While the Schema class parses the configurations on its own, this script will
30+
get the preprocessor output and get the intersection of the enabled options from
31+
our crude scraping method and the actual compiler output.
32+
We end up with the actual configured state,
33+
better than what the config files say. You can then use the
34+
a decent reflection of all enabled options that (probably) came from
35+
resulting config.ini to produce more exact configuration files.
36+
'''
3737
outdict = {}
3838
section = "user"
3939
spatt = re.compile(r".*@section +([-a-zA-Z0-9_\s]+)$") # must match @section ...
@@ -74,12 +74,12 @@ def compress_file(filepath, storedname, outpath):
7474
with zipfile.ZipFile(outpath, 'w', compression=zipfile.ZIP_BZIP2, compresslevel=9) as zipf:
7575
zipf.write(filepath, arcname=storedname, compress_type=zipfile.ZIP_BZIP2, compresslevel=9)
7676

77-
'''
78-
Compute the build signature by extracting all configuration settings and
79-
building a unique reversible signature that can be included in the binary.
80-
The signature can be reversed to get a 1:1 equivalent configuration file.
81-
'''
8277
def compute_build_signature(env):
78+
'''
79+
Compute the build signature by extracting all configuration settings and
80+
building a unique reversible signature that can be included in the binary.
81+
The signature can be reversed to get a 1:1 equivalent configuration file.
82+
'''
8383
if 'BUILD_SIGNATURE' in env: return
8484
env.Append(BUILD_SIGNATURE=1)
8585

0 commit comments

Comments
 (0)