53 lines
1.5 KiB
Python
53 lines
1.5 KiB
Python
"""
|
|
Build script for creating camera_gui.exe using PyInstaller
|
|
"""
|
|
import PyInstaller.__main__
|
|
import os
|
|
import sys
|
|
|
|
# Add PyQt5 and pyqtgraph to requirements if not present
|
|
requirements = [
|
|
'PyInstaller>=5.0',
|
|
'PyQt5>=5.15.0',
|
|
'pyqtgraph>=0.12.0',
|
|
]
|
|
|
|
def build_exe():
|
|
"""Build the executable"""
|
|
|
|
# PyInstaller arguments
|
|
args = [
|
|
'camera_gui.py',
|
|
'--name=camera_gui',
|
|
'--onefile', # Create a single executable file
|
|
'--windowed', # No console window (GUI app)
|
|
'--icon=orisys_logo_notext.png', # Use logo as icon
|
|
'--add-data=orisys_logo_notext.png;.', # Include logo file
|
|
'--hidden-import=PyQt5.QtCore',
|
|
'--hidden-import=PyQt5.QtGui',
|
|
'--hidden-import=PyQt5.QtWidgets',
|
|
'--hidden-import=pyqtgraph',
|
|
'--hidden-import=orisys',
|
|
'--hidden-import=cv2',
|
|
'--hidden-import=numpy',
|
|
'--collect-all=pyqtgraph', # Collect all pyqtgraph data
|
|
'--collect-all=PyQt5', # Collect all PyQt5 data
|
|
'--collect-all=cv2', # Collect all OpenCV data
|
|
]
|
|
|
|
# Add orisys package if it's a local package
|
|
if os.path.exists('src/orisys'):
|
|
args.append('--paths=src')
|
|
|
|
print("Building executable...")
|
|
print("Command: PyInstaller " + " ".join(args))
|
|
|
|
PyInstaller.__main__.run(args)
|
|
|
|
print("\nBuild complete! Executable is in the 'dist' folder.")
|
|
print("You can now create an installer using Inno Setup or NSIS.")
|
|
|
|
if __name__ == '__main__':
|
|
build_exe()
|
|
|