-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild_exe.py
More file actions
42 lines (33 loc) · 1.05 KB
/
build_exe.py
File metadata and controls
42 lines (33 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import os
import subprocess
import sys
import shutil
def build_executable():
"""Build the executable using PyInstaller"""
print("Building AI Document Organizer executable...")
# Clean up previous builds
if os.path.exists("build"):
print("Removing previous build directory...")
shutil.rmtree("build")
if os.path.exists("dist"):
print("Removing previous dist directory...")
shutil.rmtree("dist")
# Build the executable
print("Running PyInstaller...")
result = subprocess.run([
"pyinstaller",
"--clean",
"--version-file=version_info.txt",
"ai_document_organizer.spec"
], capture_output=True, text=True)
# Check if build was successful
if result.returncode != 0:
print("Error building executable:")
print(result.stderr)
return False
print("Build completed successfully!")
print(
f"Executable is located in: {os.path.abspath('dist/AI Document Organizer')}")
return True
if __name__ == "__main__":
build_executable()