diff --git a/build.sh b/build.sh index 76e3d868b..a8c58be99 100644 --- a/build.sh +++ b/build.sh @@ -23,8 +23,10 @@ rm -rf build dist echo "Building binary with PyInstaller..." uv run pyinstaller pyfa.spec -# cp oleacc* dist/pyfa/ +# Headless CLI exe (console) into main dist folder +if [ -f dist/pyfa_headless/pyfa-headless.exe ]; then + cp dist/pyfa_headless/pyfa-headless.exe dist/pyfa/ +fi echo "" -echo "Build complete! Binary is located at: dist/pyfa/pyfa.exe" -echo "You can run it with: dist/pyfa/pyfa.exe" +echo "Build complete! dist/pyfa/pyfa.exe (GUI), dist/pyfa/pyfa-headless.exe (CLI, use with --headless)" diff --git a/pyfa.spec b/pyfa.spec index 33fb64e0a..a198f62f8 100644 --- a/pyfa.spec +++ b/pyfa.spec @@ -96,6 +96,19 @@ exe = EXE( contents_directory='app', ) +# Headless CLI: console=True so stdout/stdin exist; use: pyfa-headless.exe --headless +exe_headless = EXE( + pyz, + a.scripts, + exclude_binaries=True, + name='pyfa-headless', + debug=debug, + strip=False, + upx=upx, + console=True, + contents_directory='app', +) + coll = COLLECT( exe, a.binaries, @@ -106,6 +119,17 @@ coll = COLLECT( name='pyfa', ) +# Headless exe; build puts it in dist/pyfa_headless/; copy pyfa-headless.exe into dist/pyfa/ after build +coll_headless = COLLECT( + exe_headless, + a.binaries, + a.zipfiles, + a.datas, + strip=False, + upx=upx, + name='pyfa_headless', +) + if platform.system() == 'Darwin': info_plist = { 'NSHighResolutionCapable': 'True',