/ build.sh
build.sh
 1  #!/bin/bash
 2  set -e
 3  
 4  if [ ! -f "venv/bin/activate" ]; then
 5    echo "Missing venv. Run: python3 -m venv venv && source venv/bin/activate && pip install -r requirements.txt"
 6    exit 1
 7  fi
 8  
 9  # Activate virtual environment
10  source venv/bin/activate
11  
12  # Convert generated icon to ICNS
13  echo "Converting icon..."
14  python scripts/convert_icon.py "assets/icon.png" "assets/icon.icns"
15  
16  # Build the app using py2app
17  echo "Building the app..."
18  rm -rf build dist
19  python setup.py py2app -A
20  
21  # Ensure it's not currently running before overwriting
22  echo "Closing existing instance (if any)..."
23  pkill -f "CursorUsage.app" || true
24  sleep 1
25  
26  # Move it to /Applications
27  echo "Moving to /Applications..."
28  rm -rf /Applications/CursorUsage.app
29  cp -R dist/CursorUsage.app /Applications/
30  
31  # Launch the newly built app
32  echo "Launching CursorUsage.app..."
33  open -a /Applications/CursorUsage.app
34  
35  echo "Success!"