import subprocess import sys import os def build(): """Compile main.py into a standalone binary using Nuitka.""" print("Starting Nuitka build process...") # Define flags # --onefile: Create a single executable # --standalone: Include all dependencies # --follow-imports: Follow all imports flags = [ sys.executable, "-m", "nuitka", "--onefile", "--standalone", "--follow-imports", "--output-filename=doc_retrieve.exe" if sys.platform == "win32" else "--output-filename=doc_retrieve", "main.py" ] print(f"Running command: {' '.join(flags)}") try: subprocess.run(flags, check=True) print("Build successful!") except subprocess.CalledProcessError as e: print(f"Build failed with exit code {e.returncode}") # Not exiting here to allow me to see the output in command_status raise if __name__ == "__main__": build()