212
212
213
213
def print_msg (* args , ** kwargs ):
214
214
global msg_print_buf
215
- # At this time, we can only handle one args value.
215
+ if 'sep' in kwargs :
216
+ sep = kwargs ['sep' ]
217
+ else :
218
+ sep = ' '
219
+
216
220
msg_print_buf += args [0 ]
221
+ for arg in args [1 :]:
222
+ msg_print_buf += sep
223
+ msg_print_buf += arg
224
+
217
225
if 'end' in kwargs :
218
226
msg_print_buf += kwargs ['end' ]
219
227
else :
@@ -225,8 +233,7 @@ def print_err(*args, **kwargs):
225
233
global err_print_flag
226
234
if (args [0 ])[0 ] != ' ' :
227
235
print_msg ("" )
228
- print_msg ("*** " , end = '' )
229
- print_msg (* args , ** kwargs )
236
+ print_msg ("***" , * args , ** kwargs )
230
237
err_print_flag = True
231
238
232
239
@@ -311,9 +318,9 @@ def extract_create_build_opt_file(globals_h_fqfn, file_name, build_opt_fqfn):
311
318
if line == build_opt_signature :
312
319
if complete_comment :
313
320
build_opt_error = True
314
- print_err (" Multiple embedded build.opt blocks in " + file_name + ":" + str ( line_no ) )
321
+ print_err (" Multiple embedded build.opt blocks in" , f' { file_name } : { line_no } ' )
315
322
continue
316
- print_msg ("Extracting embedded compiler command-line options from " + file_name + ":" + str ( line_no ) )
323
+ print_msg ("Extracting embedded compiler command-line options from" , f' { file_name } : { line_no } ' )
317
324
for line in src :
318
325
line = line .strip ()
319
326
line_no += 1
@@ -330,19 +337,19 @@ def extract_create_build_opt_file(globals_h_fqfn, file_name, build_opt_fqfn):
330
337
continue
331
338
# some consistency checking before writing - give some hints about what is wrong
332
339
elif line == build_opt_signature :
333
- print_err (" Double begin before end for embedded build.opt block in " + file_name + ":" + str ( line_no ) )
340
+ print_err (" Double begin before end for embedded build.opt block in" , f' { file_name } : { line_no } ' )
334
341
build_opt_error = True
335
342
elif line .startswith (build_opt_signature ):
336
- print_err (" build.opt signature block ignored, trailing character for embedded build.opt block in " + file_name + ":" + str ( line_no ) )
343
+ print_err (" build.opt signature block ignored, trailing character for embedded build.opt block in" , f' { file_name } : { line_no } ' )
337
344
build_opt_error = True
338
345
elif "/*" in line or "*/" in line :
339
- print_err (" Nesting issue for embedded build.opt block in " + file_name + ":" + str ( line_no ) )
346
+ print_err (" Nesting issue for embedded build.opt block in" , f' { file_name } : { line_no } ' )
340
347
build_opt_error = True
341
348
else :
342
- print_msg (" Add command-line option: " + line )
349
+ print_msg (" " , f' { line_no :2 } , Add command-line option: { line } ' , sep = '' )
343
350
build_opt .write (line + "\n " )
344
351
elif line .startswith (build_opt_signature ):
345
- print_err (" build.opt signature block ignored, trailing character for embedded build.opt block in " + file_name + ":" + str ( line_no ) )
352
+ print_err (" build.opt signature block ignored, trailing character for embedded build.opt block in" , f' { file_name } : { line_no } ' )
346
353
build_opt_error = True
347
354
if not complete_comment or build_opt_error :
348
355
build_opt .truncate (0 )
@@ -507,6 +514,10 @@ def main():
507
514
not os .path .exists (commonhfile_fqfn ):
508
515
enable_override (False , commonhfile_fqfn )
509
516
517
+ if time .time_ns () < os .stat (commonhfile_fqfn ).st_mtime_ns :
518
+ print_err (f"Neutralize future timestamp on build file: { commonhfile_fqfn } " )
519
+ touch (commonhfile_fqfn )
520
+
510
521
if not os .path .exists (build_path_core ):
511
522
os .makedirs (build_path_core )
512
523
print_msg ("Clean build, created dir " + build_path_core )
0 commit comments