|
@@ -1,8 +1,10 @@
|
1
|
1
|
#
|
2
|
2
|
# signature.py
|
3
|
3
|
#
|
4
|
|
-import subprocess,re,json,hashlib
|
5
|
4
|
import schema
|
|
5
|
+
|
|
6
|
+import subprocess,re,json,hashlib
|
|
7
|
+from datetime import datetime
|
6
|
8
|
from pathlib import Path
|
7
|
9
|
|
8
|
10
|
#
|
|
@@ -112,9 +114,9 @@ def compute_build_signature(env):
|
112
|
114
|
defines[key] = value if len(value) else ""
|
113
|
115
|
|
114
|
116
|
#
|
115
|
|
- # Continue to gather data for CONFIGURATION_EMBEDDING or CONFIG_DUMP
|
|
117
|
+ # Continue to gather data for CONFIGURATION_EMBEDDING or CONFIG_EXPORT
|
116
|
118
|
#
|
117
|
|
- if not ('CONFIGURATION_EMBEDDING' in defines or 'CONFIG_DUMP' in defines):
|
|
119
|
+ if not ('CONFIGURATION_EMBEDDING' in defines or 'CONFIG_EXPORT' in defines):
|
118
|
120
|
return
|
119
|
121
|
|
120
|
122
|
# Second step is to filter useless macro
|
|
@@ -157,18 +159,32 @@ def compute_build_signature(env):
|
157
|
159
|
except:
|
158
|
160
|
return 0
|
159
|
161
|
|
160
|
|
- config_dump = tryint('CONFIG_DUMP')
|
|
162
|
+ config_dump = tryint('CONFIG_EXPORT')
|
161
|
163
|
|
162
|
164
|
#
|
163
|
|
- # Produce an INI file if CONFIG_DUMP == 2
|
|
165
|
+ # Produce an INI file if CONFIG_EXPORT == 2
|
164
|
166
|
#
|
165
|
167
|
if config_dump == 2:
|
166
|
168
|
print("Generating config.ini ...")
|
167
|
|
- ignore = ('CONFIGURATION_H_VERSION', 'CONFIGURATION_ADV_H_VERSION', 'CONFIG_DUMP')
|
168
|
|
- filegrp = { 'Configuration.h':'config:basic', 'Configuration_adv.h':'config:advanced' }
|
169
|
169
|
config_ini = build_path / 'config.ini'
|
170
|
170
|
with config_ini.open('w') as outfile:
|
171
|
|
- outfile.write('#\n# Marlin Firmware\n# config.ini - Options to apply before the build\n#\n')
|
|
171
|
+ ignore = ('CONFIGURATION_H_VERSION', 'CONFIGURATION_ADV_H_VERSION', 'CONFIG_EXPORT')
|
|
172
|
+ filegrp = { 'Configuration.h':'config:basic', 'Configuration_adv.h':'config:advanced' }
|
|
173
|
+ vers = defines["CONFIGURATION_H_VERSION"]
|
|
174
|
+ dt_string = datetime.now().strftime("%Y-%m-%d at %H:%M:%S")
|
|
175
|
+ ini_fmt = '{0:40}{1}\n'
|
|
176
|
+ outfile.write(
|
|
177
|
+ '#\n'
|
|
178
|
+ + '# Marlin Firmware\n'
|
|
179
|
+ + '# config.ini - Options to apply before the build\n'
|
|
180
|
+ + '#\n'
|
|
181
|
+ + f'# Generated by Marlin build on {dt_string}\n'
|
|
182
|
+ + '#\n'
|
|
183
|
+ + '\n'
|
|
184
|
+ + '[config:base]\n'
|
|
185
|
+ + ini_fmt.format('ini_use_config', ' = all')
|
|
186
|
+ + ini_fmt.format('ini_config_vers', f' = {vers}')
|
|
187
|
+ )
|
172
|
188
|
# Loop through the data array of arrays
|
173
|
189
|
for header in data:
|
174
|
190
|
if header.startswith('__'):
|
|
@@ -177,10 +193,10 @@ def compute_build_signature(env):
|
177
|
193
|
for key in sorted(data[header]):
|
178
|
194
|
if key not in ignore:
|
179
|
195
|
val = 'on' if data[header][key] == '' else data[header][key]
|
180
|
|
- outfile.write('{0:40}{1}'.format(key.lower(), ' = ' + val) + '\n')
|
|
196
|
+ outfile.write(ini_fmt.format(key.lower(), ' = ' + val))
|
181
|
197
|
|
182
|
198
|
#
|
183
|
|
- # Produce a schema.json file if CONFIG_DUMP == 3
|
|
199
|
+ # Produce a schema.json file if CONFIG_EXPORT == 3
|
184
|
200
|
#
|
185
|
201
|
if config_dump >= 3:
|
186
|
202
|
try:
|
|
@@ -191,7 +207,7 @@ def compute_build_signature(env):
|
191
|
207
|
|
192
|
208
|
if conf_schema:
|
193
|
209
|
#
|
194
|
|
- # Produce a schema.json file if CONFIG_DUMP == 3
|
|
210
|
+ # Produce a schema.json file if CONFIG_EXPORT == 3
|
195
|
211
|
#
|
196
|
212
|
if config_dump in (3, 13):
|
197
|
213
|
print("Generating schema.json ...")
|
|
@@ -201,7 +217,7 @@ def compute_build_signature(env):
|
201
|
217
|
schema.dump_json(conf_schema, build_path / 'schema_grouped.json')
|
202
|
218
|
|
203
|
219
|
#
|
204
|
|
- # Produce a schema.yml file if CONFIG_DUMP == 4
|
|
220
|
+ # Produce a schema.yml file if CONFIG_EXPORT == 4
|
205
|
221
|
#
|
206
|
222
|
elif config_dump == 4:
|
207
|
223
|
print("Generating schema.yml ...")
|
|
@@ -226,7 +242,7 @@ def compute_build_signature(env):
|
226
|
242
|
pass
|
227
|
243
|
|
228
|
244
|
#
|
229
|
|
- # Produce a JSON file for CONFIGURATION_EMBEDDING or CONFIG_DUMP == 1
|
|
245
|
+ # Produce a JSON file for CONFIGURATION_EMBEDDING or CONFIG_EXPORT == 1
|
230
|
246
|
#
|
231
|
247
|
if config_dump == 1 or 'CONFIGURATION_EMBEDDING' in defines:
|
232
|
248
|
with marlin_json.open('w') as outfile:
|