130 lines
3.4 KiB
Python
130 lines
3.4 KiB
Python
# -*- mode: python ; coding: utf-8 -*-
|
|
import os
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
# Get base directory
|
|
base_dir = Path.cwd()
|
|
|
|
# Add src directory to path for imports
|
|
src_path = base_dir / 'src'
|
|
sys.path.insert(0, str(src_path))
|
|
|
|
# Import version info
|
|
try:
|
|
from __init__ import __version__, __app_name__
|
|
except ImportError:
|
|
__version__ = "1.0.0"
|
|
__app_name__ = "HereIAm"
|
|
|
|
# Define paths
|
|
src_dir = base_dir / "src"
|
|
assets_dir = base_dir / "assets"
|
|
dist_dir = base_dir / "dist"
|
|
|
|
block_cipher = None
|
|
|
|
a = Analysis(
|
|
[str(src_dir / 'main.py')],
|
|
pathex=[str(src_dir)],
|
|
binaries=[],
|
|
datas=[
|
|
(str(assets_dir / '*.icns'), 'assets'),
|
|
(str(assets_dir), 'assets'),
|
|
],
|
|
hiddenimports=[
|
|
'PyQt5.QtCore',
|
|
'PyQt5.QtGui',
|
|
'PyQt5.QtWidgets',
|
|
'pyautogui',
|
|
'objc',
|
|
'objc._objc',
|
|
'Foundation',
|
|
'Cocoa',
|
|
'AppKit',
|
|
'Quartz',
|
|
'CoreFoundation',
|
|
'xml',
|
|
'xml.etree',
|
|
'xml.etree.ElementTree',
|
|
],
|
|
hookspath=[],
|
|
hooksconfig={},
|
|
runtime_hooks=[],
|
|
excludes=[
|
|
'tkinter',
|
|
'unittest',
|
|
'email',
|
|
'http',
|
|
'pydoc',
|
|
],
|
|
win_no_prefer_redirects=False,
|
|
win_private_assemblies=False,
|
|
cipher=block_cipher,
|
|
noarchive=False,
|
|
)
|
|
|
|
# Remove unnecessary modules to reduce size
|
|
a.binaries = [x for x in a.binaries if not x[0].startswith('tk')]
|
|
a.binaries = [x for x in a.binaries if not x[0].startswith('tcl')]
|
|
|
|
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
|
|
|
|
exe = EXE(
|
|
pyz,
|
|
a.scripts,
|
|
[],
|
|
exclude_binaries=True,
|
|
name=__app_name__,
|
|
debug=False,
|
|
bootloader_ignore_signals=False,
|
|
strip=False,
|
|
upx=True,
|
|
console=False, # No console window
|
|
disable_windowed_traceback=False,
|
|
argv_emulation=False,
|
|
target_arch=None,
|
|
codesign_identity=None, # Will be signed manually after build
|
|
entitlements_file='entitlements.plist', # Add entitlements for accessibility
|
|
icon=str(assets_dir / 'Enabled.icns'),
|
|
)
|
|
|
|
coll = COLLECT(
|
|
exe,
|
|
a.binaries,
|
|
a.zipfiles,
|
|
a.datas,
|
|
strip=False,
|
|
upx=True,
|
|
upx_exclude=[],
|
|
name=__app_name__,
|
|
)
|
|
|
|
app = BUNDLE(
|
|
coll,
|
|
name=f'{__app_name__}.app',
|
|
icon=str(assets_dir / 'Enabled.icns'),
|
|
bundle_identifier=f'net.tekop.{__app_name__.lower()}',
|
|
version=__version__,
|
|
info_plist={
|
|
'CFBundleName': __app_name__,
|
|
'CFBundleDisplayName': __app_name__,
|
|
'CFBundleGetInfoString': f'{__app_name__} - Mouse Movement Monitor',
|
|
'CFBundleIdentifier': f'net.tekop.{__app_name__.lower()}',
|
|
'CFBundleVersion': __version__,
|
|
'CFBundleShortVersionString': __version__,
|
|
'NSPrincipalClass': 'NSApplication',
|
|
'NSAppleScriptEnabled': False,
|
|
'NSHighResolutionCapable': True,
|
|
'LSUIElement': True, # This makes it a menu bar only app (no dock icon)
|
|
'LSMinimumSystemVersion': '10.14.0',
|
|
'NSHumanReadableCopyright': f'Copyright © 2025 Jerico Thomas. All rights reserved.',
|
|
'CFBundleDocumentTypes': [],
|
|
'NSRequiresAquaSystemAppearance': False, # Support dark mode
|
|
'LSApplicationCategoryType': 'public.app-category.utilities',
|
|
# Accessibility permissions
|
|
'NSAppleEventsUsageDescription': 'HereIAm needs to move the mouse cursor to prevent system sleep.',
|
|
'NSSystemAdministrationUsageDescription': 'HereIAm needs accessibility access to monitor and move the mouse cursor.',
|
|
},
|
|
)
|