()
| 353 | |
| 354 | |
| 355 | def main(): |
| 356 | parser = argparse.ArgumentParser(description=(__doc__ or "").splitlines()[0]) |
| 357 | parser.add_argument( |
| 358 | "persist_dir", |
| 359 | nargs="?", |
| 360 | type=Path, |
| 361 | help="Optional directory to persist intermediate PNGs (default: tempdir).", |
| 362 | ) |
| 363 | parser.add_argument( |
| 364 | "--installer-jpegs", |
| 365 | action="store_true", |
| 366 | help=( |
| 367 | "Only regenerate the per-build installer JPGs (Generated Images/*.jpg). " |
| 368 | "Used by pre_release.py --release before the MSI build." |
| 369 | ), |
| 370 | ) |
| 371 | args = parser.parse_args() |
| 372 | |
| 373 | persist_dir = args.persist_dir |
| 374 | if persist_dir: |
| 375 | persist_dir.mkdir(parents=True, exist_ok=True) |
| 376 | print(f"Persisting PNGs to: {persist_dir}") |
| 377 | |
| 378 | inkscape = find_inkscape() |
| 379 | print(f"Using Inkscape: {inkscape}") |
| 380 | print(f"Logo directory: {LOGO_DIR}") |
| 381 | |
| 382 | ctx = contextlib.nullcontext(str(persist_dir)) if persist_dir else tempfile.TemporaryDirectory() |
| 383 | with ctx as work: |
| 384 | if args.installer_jpegs: |
| 385 | print("Rendering installer JPGs...") |
| 386 | render_installer_jpegs(inkscape, Path(work)) |
| 387 | return |
| 388 | |
| 389 | images = render_all_sizes(inkscape, Path(work)) |
| 390 | images[-1].save(ICO_PATH, format="ICO", append_images=images[:-1]) |
| 391 | |
| 392 | print(f"Output ICO: {ICO_PATH}") |
| 393 | print("Copying favicons...") |
| 394 | for dest in FAVICON_OUTPUTS: |
| 395 | shutil.copy2(ICO_PATH, dest) |
| 396 | print(f" {dest.relative_to(REPO_DIR)}") |
| 397 | render_logos(inkscape) |
| 398 | print("Rendering installer branding (static assets)...") |
| 399 | render_installer_static(inkscape, Path(work)) |
| 400 | print("Rendering installer JPGs...") |
| 401 | render_installer_jpegs(inkscape, Path(work)) |
| 402 | |
| 403 | |
| 404 | if __name__ == "__main__": |
no test coverage detected