-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.py
More file actions
executable file
·71 lines (61 loc) · 2.19 KB
/
build.py
File metadata and controls
executable file
·71 lines (61 loc) · 2.19 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
70
71
#!/usr/bin/env python3
"""
Universal build script for FFmpeg GUI
Supports macOS ARM64 and Windows AMD64 builds
"""
import os
import sys
import argparse
import subprocess
from pathlib import Path
def main():
parser = argparse.ArgumentParser(description='Build FFmpeg GUI executables')
parser.add_argument('platform', choices=['macos', 'windows', 'both'],
help='Target platform to build for')
parser.add_argument('--clean', action='store_true',
help='Clean build artifacts before building')
args = parser.parse_args()
# Check virtual environment
if not os.environ.get('VIRTUAL_ENV'):
print("Error: Virtual environment not active")
print("Activate with: source .venv/bin/activate")
sys.exit(1)
# Clean if requested
if args.clean:
print("Cleaning build artifacts...")
subprocess.run(['python', '-c', '''
import os, shutil
dirs = ["build", "dist", "__pycache__"]
files = ["*.spec", "*.dmg", "*.zip", "version_info.txt"]
for d in dirs:
if os.path.exists(d): shutil.rmtree(d)
import glob
for pattern in files:
for f in glob.glob(pattern): os.remove(f)
print("Cleaned.")
'''])
# Install PyInstaller if not present
try:
import PyInstaller
except ImportError:
print("Installing PyInstaller...")
subprocess.run([sys.executable, '-m', 'pip', 'install', 'pyinstaller>=6.0.0'])
# Build based on platform
if args.platform in ['macos', 'both']:
if sys.platform == 'darwin':
print("Building macOS ARM64 version...")
result = subprocess.run([sys.executable, 'build_macos.py'])
if result.returncode != 0:
print("macOS build failed")
sys.exit(1)
else:
print("Warning: macOS build requires macOS system")
if args.platform in ['windows', 'both']:
print("Building Windows AMD64 version...")
result = subprocess.run([sys.executable, 'build_windows.py'])
if result.returncode != 0:
print("Windows build failed")
sys.exit(1)
print("Build completed successfully!")
if __name__ == '__main__':
main()