Skip to content

Commit

Permalink
Release AutoArchive 0.0.2a
Browse files Browse the repository at this point in the history
- universal binary included with build support
  • Loading branch information
dingwen07 committed May 23, 2024
1 parent e695ba9 commit 30e9ff5
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 6 deletions.
61 changes: 61 additions & 0 deletions build-universal.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/bin/bash

# functions
trash() { osascript -e "tell application \"Finder\" to delete POSIX file \"$(realpath "$1")\"" > /dev/null; }

BUILD_DIR=./build/universal
mkdir -p $BUILD_DIR
BUILD_DIR=$(realpath $BUILD_DIR)
BUILD_TMP_DIR=/tmp/autoarchive-build-universal-$(date +%s)
PYTHON=/usr/bin/python3
export PATH=/usr/bin:$PATH

# Hello
echo "AutoArchive Universal Build Utility"

if [ "$(arch)" == "arm64" ]; then
echo "Running on arm64, switching to x86_64"
arch -x86_64 $0
exit
fi
echo "Running on $(arch)"
echo "Build Directory: $BUILD_DIR"

echo "Copy to temporary directory: $BUILD_TMP_DIR"
if [ -d "./build" ]; then
trash ./build
fi
mkdir $BUILD_TMP_DIR
cp -R ./ $BUILD_TMP_DIR
echo "Move files to $BUILD_DIR"
mkdir -p $BUILD_DIR
mv $BUILD_TMP_DIR/* $BUILD_DIR/
cd $BUILD_DIR
echo "Current Directory: $(pwd)"
echo "Deleting obsolete files..."
# if exist ./dist, ./test ./venv, delete them
if [ -d "./dist" ]; then
trash ./dist
fi
if [ -d "./test" ]; then
trash ./test
fi
if [ -d "./venv" ]; then
trash ./venv
fi

mkdir ./dist
mkdir ./test

echo "Creating virtual environment..."
$PYTHON -m venv ./venv
echo "Installing dependencies..."
source ./venv/bin/activate
pip install -r requirements.txt
deactivate

echo "Running Build Utility..."
./build.sh

echo "Build Utility complete."
echo "Run 'cd ./build/universal' for next steps."
18 changes: 15 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,25 @@
# functions
trash() { osascript -e "tell application \"Finder\" to delete POSIX file \"$(realpath "$1")\"" > /dev/null; }

# Hello
echo "AutoArchive Build Utility"
echo "Running on $(arch)"

# if not exist ./test, create it
if [ ! -d "./test" ]; then
mkdir ./test
fi
trash ./build ./dist
trash ./test/AutoArchive.app
trash ./dist/AutoArchive.zip

# if exist ./build, ./dist, ./test/AutoArchive.app, delete them
if [ -d "./build" ]; then
trash ./build
fi
if [ -d "./dist" ]; then
trash ./dist
fi
if [ -d "./test/AutoArchive.app" ]; then
trash ./test/AutoArchive.app
fi

source ./venv/bin/activate

Expand Down
4 changes: 3 additions & 1 deletion release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ TEAM_ID=$(op read "op://Personal/z4sp6gvcgzeejgvf6mufvqwrme/Developer/Team ID")
APP_NAME="AutoArchive"
APP_DIRNAME="$APP_NAME.app"

# Hello
echo "$APP_NAME Release Utility"

source=${1:-"./dist/$APP_DIRNAME"}
source=$(realpath "$source")
source_parent=$(dirname "$source")
Expand Down Expand Up @@ -47,4 +50,3 @@ spctl -vvv --assess --type exec $source

trash $source_parent/AutoArchive.zip
/usr/bin/ditto -c -k --keepParent $source $source_parent/AutoArchive.zip
cp -R ./dist/AutoArchive.app ./test/AutoArchive.app
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
py2app~=0.28.7
setuptools<70.0.0
wheel
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

APP = ['auto_archive.py']
DATA_FILES = []
VERSION = '0.0.2'
VERSION = '0.0.2a'

PLIST = {
'CFBundleShortVersionString': VERSION,
Expand Down
2 changes: 1 addition & 1 deletion update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ APP_NAME="AutoArchive"
APP_DIRNAME="$APP_NAME.app"

# Hello
echo "$APP_NAME Updater"
echo "$APP_NAME Update Utility"

# Try read source from argument, if not provided, use "./dist/AutoArchive.app"
source=${1:-"./dist/$APP_DIRNAME"}
Expand Down

0 comments on commit 30e9ff5

Please sign in to comment.