-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.py
43 lines (34 loc) · 1.56 KB
/
build.py
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
import os
import platform
import shutil
# Removes current binaries if they exist
if os.path.exists('dist'):
shutil.rmtree('dist')
if (platform.system() == "Windows"):
os.system('pyinstaller --onefile -w -i app_icon.ico --add-data app_icon.ico:app_icon.ico OSCSceneController.py')
elif (platform.system() == "Linux"):
os.system('pyinstaller --onefile -w -i app_icon.ico --add-data app_icon.ico:app_icon.ico OSCSceneController.py')
elif (platform.system() == "Darwin"): # MacOS
# Generate spec file
os.system('pyi-makespec --onefile -w --osx-bundle-identifier com.peters.osc-scenes -i app_icon.icns OSCSceneController.py')
plist = """
info_plist={
'NSHighResolutionCapable': 'True',
'CFBundleShortVersionString':'0.1.1',
'CFBundleVersion':'0.1.1',
'CFBundleDisplayName':"OSC Scene Controller",
'CFBundleName':"OSC Scene Controller",
'CFBundleGetInfoString':"Scene Controller for OSC and MIDI devices",
'NSHumanReadableCopyright':"Copyright 2018, Peter Steffey, All Rights Reserved"
},\n"""
# Add custom options into spec file
with open('OSCSceneController.spec', 'r') as inFile:
with open('OSCSceneController.spec.new', 'w') as outFile:
for line in inFile.readlines():
outFile.write(line)
if 'BUNDLE' in line:
outFile.write(plist)
os.rename('OSCSceneController.spec.new', 'OSCSceneController.spec')
# Run from spec file
os.system('pyinstaller OSCSceneController.spec')
print("Success!")