|
174 | 174 | os.environ["CFLAGS"] = "-Werror=cpp" |
175 | 175 | os.environ["CXXFLAGS"] = "-Werror=cpp" |
176 | 176 |
|
177 | | -ordered_targets = [] |
| 177 | +updated_examples = set() |
178 | 178 |
|
179 | 179 | for board in boards: |
180 | 180 | for platform in platforms[board]: |
@@ -329,8 +329,6 @@ def test_build(target, v): |
329 | 329 | shutil.rmtree(f"{dir}-build") |
330 | 330 | return ret |
331 | 331 |
|
332 | | - ordered_targets.extend(target_locs.keys()) |
333 | | - |
334 | 332 | with multiprocessing.Pool(processes=os.cpu_count()) as pool: |
335 | 333 | ret = pool.starmap( |
336 | 334 | test_build, |
@@ -367,11 +365,32 @@ def test_build(target, v): |
367 | 365 | "supportRiscV": "riscv" in platform, |
368 | 366 | } |
369 | 367 | # Write out after each platform |
| 368 | + with open( |
| 369 | + f"{os.path.dirname(os.path.realpath(__file__))}/../data/{CURRENT_DATA_VERSION}/examples.json", |
| 370 | + "r", |
| 371 | + ) as f: |
| 372 | + current_examples = json.load(f) |
| 373 | + |
| 374 | + current_examples.update(examples) |
| 375 | + updated_examples.update(examples.keys()) |
| 376 | + |
370 | 377 | with open( |
371 | 378 | f"{os.path.dirname(os.path.realpath(__file__))}/../data/{CURRENT_DATA_VERSION}/examples.json", |
372 | 379 | "w", |
373 | 380 | ) as f: |
374 | | - sorted_examples = dict( |
375 | | - sorted(examples.items(), key=lambda x: ordered_targets.index(x[0])) |
376 | | - ) |
377 | | - json.dump(sorted_examples, f, indent=4) |
| 381 | + json.dump(current_examples, f, indent=4) |
| 382 | + |
| 383 | +# Finalise list, removing any examples no longer supported |
| 384 | +with open( |
| 385 | + f"{os.path.dirname(os.path.realpath(__file__))}/../data/{CURRENT_DATA_VERSION}/examples.json", |
| 386 | + "r", |
| 387 | +) as f: |
| 388 | + current_examples = dict(json.load(f)) |
| 389 | + |
| 390 | +current_examples = {k: v for k, v in current_examples.items() if k in updated_examples} |
| 391 | + |
| 392 | +with open( |
| 393 | + f"{os.path.dirname(os.path.realpath(__file__))}/../data/{CURRENT_DATA_VERSION}/examples.json", |
| 394 | + "w", |
| 395 | +) as f: |
| 396 | + json.dump(current_examples, f, indent=4) |
0 commit comments