-
Notifications
You must be signed in to change notification settings - Fork 258
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Build Script for mac os systems (#76)
* chore: add TagStudio.spec to gitignore Prevent TagStudio.spec to be added to repo in the future * chore: add Build Script for macos Create script using pyinstaller to generate a macos app for tagstudio * chore: revert duplicated files * chore: rename build file naming
- Loading branch information
1 parent
f9ea20e
commit 8321f43
Showing
2 changed files
with
69 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#! /usr/bin/env bash | ||
# GETTING BASE DIR | ||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
|
||
# SETTING UP CONSTANTS | ||
TAGSTUDIO_NAME="TagStudio" | ||
TAGSTUDIO_DIR="$SCRIPT_DIR/tagstudio" | ||
TAGSTUDIO_DIR_RESOURCES="$TAGSTUDIO_DIR/resources" | ||
TAGSTUDIO_ICON="$TAGSTUDIO_DIR/resources/icon.ico" | ||
TAGSTUDIO_SRC="$TAGSTUDIO_DIR/src" | ||
TAGSTUDIO_MAIN="$TAGSTUDIO_DIR/tag_studio.py" | ||
DIST_PATH="$SCRIPT_DIR/dist" | ||
BUILD_PATH="$SCRIPT_DIR/build" | ||
LOGS_PATH="$BUILD_PATH/logs" | ||
|
||
printf -- "π Starting Script \n" | ||
|
||
# CREATE VENV AND INSTALL REQUIREMENTS | ||
printf -- "π Creating Python virtual env\n" | ||
python3 -m venv .venv | ||
source .venv/bin/activate | ||
|
||
if [ ! -d $LOGS_PATH ]; then | ||
printf -- "π Creating Logs folder\n" | ||
mkdir -p $LOGS_PATH; | ||
fi | ||
|
||
printf -- "π» Installing Requirements \n" | ||
pip install -r requirements.txt > "$LOGS_PATH/pip.log" 2>&1 | ||
pip install PyInstaller > "$LOGS_PATH/pip.log" 2>&1 | ||
|
||
|
||
if [[ "$OSTYPE" == "darwin"* ]]; then | ||
printf -- "π MacOS Detected \n" | ||
SYS_CMD="--windowed" | ||
OS=0 | ||
fi | ||
|
||
SECONDS=0 | ||
|
||
# CREATE COMMAND | ||
printf -- "β³ Building App \n" | ||
|
||
COMMAND=$( python -m PyInstaller \ | ||
--name "$TAGSTUDIO_NAME" \ | ||
--icon "$TAGSTUDIO_ICON" \ | ||
--add-data "$TAGSTUDIO_DIR_RESOURCES:./resources" \ | ||
--add-data "$TAGSTUDIO_SRC:./src" \ | ||
--distpath "$DIST_PATH" \ | ||
-p "$TAGSTUDIO_DIR" \ | ||
--noconsole \ | ||
--workpath "$BUILD_PATH" \ | ||
-y "$SYS_CMD" "$TAGSTUDIO_MAIN" \ | ||
> "$LOGS_PATH/pyinstaller.log" 2>&1 ) | ||
|
||
duration=$SECONDS | ||
|
||
if $COMMAND; then | ||
printf -- "β Build Successfull \n" | ||
printf -- "β $((duration)) seconds of build\n" | ||
if [[ "$OS" == 0 ]]; then | ||
printf -- "π Opening App folder \n" | ||
open $DIST_PATH | ||
fi | ||
else | ||
printf -- "β Error Building the app\nPlease read the logs\navailable at build/logs\n" | ||
fi | ||
|
||
printf -- "π END OF TRANSMISSION" |