| 328 | import threading |
| 329 | import time |
| 330 | def monitor_log_file(log_file_path): |
| 331 | if not os.path.exists(log_file_path): |
| 332 | open(log_file_path, 'w').close() |
| 333 | empty_line_count = 0 |
| 334 | with open(log_file_path, 'r') as log_file: |
| 335 | while True: |
| 336 | line = log_file.readline() |
| 337 | if line: |
| 338 | print(line.strip()) |
| 339 | if 'Build Time Elapsed' in line: |
| 340 | break |
| 341 | empty_line_count = 0 |
| 342 | else: |
| 343 | empty_line_count += 1 |
| 344 | time.sleep(1) |
| 345 | if empty_line_count > 30: |
| 346 | print("Timeout reached or too many empty lines, exiting log monitoring thread.") |
| 347 | break |
| 348 | def MDK5Project(env, target, script): |
| 349 | |
| 350 | if os.path.isfile('template.uvprojx') is False: |