Skip to content

Commit d2e6b40

Browse files
committed
Updating Primerool: README, gitignore and the app itself so that it boots smoothly in the app.
1 parent d7d535a commit d2e6b40

3 files changed

Lines changed: 18 additions & 8 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ build_venv/
1818
# PyInstaller Outputs
1919
build/
2020
dist/
21+
*.spec
22+

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,21 @@ Every designed primer is automatically checked for:
105105

106106
### macOS
107107

108-
1. Double-click the **`Primerool.app`** application icon.
109-
2. It will automatically install dependencies if needed, and launch as a native desktop application with a dedicated dock icon.
108+
1. Navigate to the `dist/` folder and double-click the **`Primerool.app`** bundle.
109+
2. It will instantly launch as a native PyInstaller desktop application with a custom dock icon.
110+
111+
**Building for macOS:**
112+
To compile the standalone OS X application yourself, run the automated packager:
113+
```bash
114+
./scripts/build_mac.sh
115+
```
116+
This will generate the `dist/Primerool.app` and `Primerool.dmg` installers.
110117

111118
### Windows
112119

113120
1. Double-click **`Run_primerool.bat`**
114121
2. If Python isn't installed, it's downloaded automatically — close the window and run the `.bat` again after installation
115-
3. On the second run, the app launches as a native desktop application
122+
3. On the second run, the app installs all dependencies and launches as a native desktop application window.
116123

117124
### Development / Manual Setup
118125

src/app.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,13 @@ def _api(source: str):
2626

2727
def get_resource_path(relative_path):
2828
"""Get absolute path to resource, works for dev and for PyInstaller."""
29-
try:
30-
# PyInstaller creates a temp folder and stores path in _MEIPASS
31-
base_path = sys._MEIPASS
32-
except Exception:
29+
if getattr(sys, 'frozen', False):
30+
if sys.platform == 'darwin' and '.app/Contents/MacOS' in sys.executable:
31+
base_path = os.path.abspath(os.path.join(os.path.dirname(sys.executable), '..', 'Resources'))
32+
else:
33+
base_path = getattr(sys, '_MEIPASS', os.path.dirname(sys.executable))
34+
else:
3335
base_path = os.path.dirname(os.path.abspath(__file__))
34-
3536
return os.path.join(base_path, relative_path)
3637

3738
app = Flask(__name__,

0 commit comments

Comments
 (0)