File tree Expand file tree Collapse file tree 1 file changed +19
-6
lines changed
Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Original file line number Diff line number Diff line change 3434
3535# Set PyInstaller mode based on torch variant and platform
3636if [[ " $MACOS_APP " == true ]]; then
37- PYINSTALLER_MODE=" "
37+ PYINSTALLER_MODE=" --windowed "
3838elif [[ " $TORCH_VARIANT " == cpu ]]; then
3939 PYINSTALLER_MODE=" --onefile"
4040else
@@ -129,13 +129,26 @@ df -h
129129# After PyInstaller
130130rm -rf build/ # Remove PyInstaller temp files
131131
132- # Remove unpacked directory if building macOS app bundle
132+ # Post-process macOS .app bundle to launch in Terminal
133133if [[ " $MACOS_APP " == true ]]; then
134- if [ -d dist/photomap ]; then
135- rm -rf dist/photomap
136- fi
134+ APP_BUNDLE=" dist/photomap.app"
135+ MACOS_DIR=" $APP_BUNDLE /Contents/MacOS"
136+ BIN_NAME=" photomap"
137+
138+ # Create a launcher script
139+ LAUNCHER=" $MACOS_DIR /run_in_terminal.sh"
140+ cat > " $LAUNCHER " << EOF
141+ #!/bin/bash
142+ exec osascript -e 'tell application "Terminal" to do script "'"$MACOS_DIR /$BIN_NAME "'"'
143+ EOF
144+ chmod +x " $LAUNCHER "
145+
146+ # Update Info.plist to use the launcher script
147+ PLIST=" $APP_BUNDLE /Contents/Info.plist"
148+ /usr/libexec/PlistBuddy -c " Set :CFBundleExecutable run_in_terminal.sh" " $PLIST "
149+
137150 echo " ✅ macOS app bundle created: dist/photomap.app"
138- echo " Users can double-click photomap.app to launch PhotoMap"
151+ echo " Users can double-click photomap.app to launch PhotoMap in Terminal "
139152else
140153 echo " ✅ Executable created in dist/ directory"
141154fi
You can’t perform that action at this time.
0 commit comments