-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.py
More file actions
69 lines (59 loc) 路 1.66 KB
/
Copy pathbuild.py
File metadata and controls
69 lines (59 loc) 路 1.66 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env python3
"""
Build script for creating the Vidleech standalone executable.
"""
import os
import shutil
import subprocess
from pathlib import Path
def clean_build():
"""Clean previous build artifacts."""
print("Cleaning build directories...")
dirs_to_clean = ['build', 'dist']
for dir_name in dirs_to_clean:
if os.path.exists(dir_name):
shutil.rmtree(dir_name)
# Clean PyInstaller spec file
spec_file = 'vidleech.spec'
if os.path.exists(spec_file):
os.remove(spec_file)
def build_executable():
"""Build the standalone executable."""
print("Building Vidleech executable...")
# PyInstaller command
cmd = [
'pyinstaller',
'--name=vidleech',
'--onefile',
'--noconsole',
'--clean',
'--add-data=LICENSE;.',
'--hidden-import=PyQt6.sip',
'src/main.py'
]
# Add Windows-specific options
if os.name == 'nt':
cmd.extend([
'--icon=src/resources/icon.ico',
'--version-file=version_info.txt'
])
try:
subprocess.run(cmd, check=True)
print("\nBuild successful!")
print(f"Executable created at: {os.path.abspath('dist/vidleech.exe')}")
return True
except subprocess.CalledProcessError as e:
print(f"\nBuild failed with error: {e}")
return False
def main():
"""Main build process."""
# Clean previous builds
clean_build()
# Create build
if build_executable():
print("\nBuild completed successfully!")
else:
print("\nBuild failed!")
exit(1)
if __name__ == '__main__':
main()