212212
213213def print_msg (* args , ** kwargs ):
214214 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+
216220 msg_print_buf += args [0 ]
221+ for arg in args [1 :]:
222+ msg_print_buf += sep
223+ msg_print_buf += arg
224+
217225 if 'end' in kwargs :
218226 msg_print_buf += kwargs ['end' ]
219227 else :
@@ -225,8 +233,7 @@ def print_err(*args, **kwargs):
225233 global err_print_flag
226234 if (args [0 ])[0 ] != ' ' :
227235 print_msg ("" )
228- print_msg ("*** " , end = '' )
229- print_msg (* args , ** kwargs )
236+ print_msg ("***" , * args , ** kwargs )
230237 err_print_flag = True
231238
232239
@@ -311,9 +318,9 @@ def extract_create_build_opt_file(globals_h_fqfn, file_name, build_opt_fqfn):
311318 if line == build_opt_signature :
312319 if complete_comment :
313320 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 } ' )
315322 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 } ' )
317324 for line in src :
318325 line = line .strip ()
319326 line_no += 1
@@ -330,19 +337,19 @@ def extract_create_build_opt_file(globals_h_fqfn, file_name, build_opt_fqfn):
330337 continue
331338 # some consistency checking before writing - give some hints about what is wrong
332339 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 } ' )
334341 build_opt_error = True
335342 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 } ' )
337344 build_opt_error = True
338345 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 } ' )
340347 build_opt_error = True
341348 else :
342- print_msg (" Add command-line option: " + line )
349+ print_msg (" " , f' { line_no :2 } , Add command-line option: { line } ' , sep = '' )
343350 build_opt .write (line + "\n " )
344351 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 } ' )
346353 build_opt_error = True
347354 if not complete_comment or build_opt_error :
348355 build_opt .truncate (0 )
@@ -507,6 +514,10 @@ def main():
507514 not os .path .exists (commonhfile_fqfn ):
508515 enable_override (False , commonhfile_fqfn )
509516
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+
510521 if not os .path .exists (build_path_core ):
511522 os .makedirs (build_path_core )
512523 print_msg ("Clean build, created dir " + build_path_core )
0 commit comments