|
| 1 | +from pathlib import Path |
| 2 | +import PyInstaller.__main__ |
| 3 | + |
| 4 | +HERE = Path(__file__).resolve().parent # trainer/src/build |
| 5 | +SRC = HERE.parent # trainer/src |
| 6 | +ENTRY = SRC / "main.py" |
| 7 | + |
| 8 | +DIST = SRC / "dist" |
| 9 | +WORK = SRC / "build" / "_pyi_work" |
| 10 | + |
| 11 | +PyInstaller.__main__.run([ |
| 12 | + "--noconfirm", |
| 13 | + "--clean", |
| 14 | + "--name", "RootPainterTrainer", |
| 15 | + "--console", |
| 16 | + |
| 17 | + # CRITICAL: make trainer/src importable during analysis (so 'trainer.py' is found) |
| 18 | + "--paths", str(SRC), |
| 19 | + |
| 20 | + # Ensure local module is bundled |
| 21 | + "--hidden-import", "trainer", |
| 22 | + |
| 23 | + # Torch bits |
| 24 | + "--hidden-import", "torch", |
| 25 | + "--hidden-import", "torchvision", |
| 26 | + "--hidden-import", "torchvision.ops", |
| 27 | + "--hidden-import", "torchvision.io", |
| 28 | + "--hidden-import", "torchvision.transforms", |
| 29 | + |
| 30 | + "--distpath", str(DIST), |
| 31 | + "--workpath", str(WORK), |
| 32 | + str(ENTRY), |
| 33 | +]) |
| 34 | + |
| 35 | +print("Built:", DIST / "RootPainterTrainer") |
0 commit comments