|
8 | 8 | from datetime import datetime
|
9 | 9 | from pathlib import Path
|
10 | 10 |
|
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 |
| -''' |
36 | 11 | 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 | + ''' |
37 | 37 | outdict = {}
|
38 | 38 | section = "user"
|
39 | 39 | spatt = re.compile(r".*@section +([-a-zA-Z0-9_\s]+)$") # must match @section ...
|
@@ -74,12 +74,12 @@ def compress_file(filepath, storedname, outpath):
|
74 | 74 | with zipfile.ZipFile(outpath, 'w', compression=zipfile.ZIP_BZIP2, compresslevel=9) as zipf:
|
75 | 75 | zipf.write(filepath, arcname=storedname, compress_type=zipfile.ZIP_BZIP2, compresslevel=9)
|
76 | 76 |
|
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 |
| -''' |
82 | 77 | 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 | + ''' |
83 | 83 | if 'BUILD_SIGNATURE' in env: return
|
84 | 84 | env.Append(BUILD_SIGNATURE=1)
|
85 | 85 |
|
|
0 commit comments