Skip to content

Commit

Permalink
Merge branch 'dev/macos-app' of https://github.com/ActivityWatch/acti…
Browse files Browse the repository at this point in the history
  • Loading branch information
xylix committed Jan 27, 2020
2 parents e23d750 + 5e4de1e commit 90183cd
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dist
__pycache__
.*cache
*.swp
.DS_Store

.idea
venv*
Expand Down
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ before_install:
# Linux:
# - Install nvm and use correct node version
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
sudo apt-get install libqt5xml5;
rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm install $TRAVIS_NODE_VERSION;
fi
# Upgrade pip
Expand All @@ -87,6 +88,9 @@ script:
- "make test"
- "make test-integration"
- "make package"
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
make dist/ActivityWatch.app;
fi

before_deploy:
# Remove the folder from which the zip was created
Expand Down
24 changes: 21 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Instructions on how to do this can be found in the guide linked above.

# These targets should always rerun
.PHONY: build install test clean clean_all
.PHONY: build install test clean clean_all dist/ActivityWatch.app

SHELL := /usr/bin/env bash

Expand Down Expand Up @@ -125,8 +125,26 @@ test-integration:
# Example: https://ci.appveyor.com/project/ErikBjare/activitywatch/build/1.0.167/job/k1ulexsc5ar5uv4v
pytest ./scripts/tests/integration_tests.py ./aw-server/tests/ -v

pyinstaller:
pip install -r requirements.txt
ICON := "aw-qt/media/logo/logo.png"

aw-qt/media/logo/logo.icns:
mkdir -p build/MyIcon.iconset
sips -z 16 16 $(ICON) --out build/MyIcon.iconset/icon_16x16.png
sips -z 32 32 $(ICON) --out build/MyIcon.iconset/icon_16x16@2x.png
sips -z 32 32 $(ICON) --out build/MyIcon.iconset/icon_32x32.png
sips -z 64 64 $(ICON) --out build/MyIcon.iconset/icon_32x32@2x.png
sips -z 128 128 $(ICON) --out build/MyIcon.iconset/icon_128x128.png
sips -z 256 256 $(ICON) --out build/MyIcon.iconset/icon_128x128@2x.png
sips -z 256 256 $(ICON) --out build/MyIcon.iconset/icon_256x256.png
sips -z 512 512 $(ICON) --out build/MyIcon.iconset/icon_256x256@2x.png
sips -z 512 512 $(ICON) --out build/MyIcon.iconset/icon_512x512.png
cp $(ICON) build/MyIcon.iconset/icon_512x512@2x.png
iconutil -c icns build/MyIcon.iconset
rm -R build/MyIcon.iconset
mv build/MyIcon.icns aw-qt/media/logo/logo.icns

dist/ActivityWatch.app: aw-qt/media/logo/logo.icns
pip install git+git://github.com/pyinstaller/pyinstaller.git@55c8855d9db0fa596ceb28505f3ee2f402ecd4da
pyinstaller --clean --noconfirm --windowed aw.spec

package:
Expand Down
15 changes: 8 additions & 7 deletions aw.spec
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ aw_qt_location = "aw-qt/"
awa_location = "aw-watcher-afk/"
aww_location = "aw-watcher-window/"

icon = aw_qt_location + 'media/logo/logo.ico'
macos_icon = aw_qt_location + 'media/logo/icon.icns'
if platform.system() == "Darwin":
icon = aw_qt_location + 'media/logo/logo.icns'
else:
icon = aw_qt_location + 'media/logo/logo.ico'
block_cipher = None

extra_pathex = []
Expand Down Expand Up @@ -187,12 +189,11 @@ if platform.system() == "Darwin":
awa_coll,
aws_coll,
name="ActivityWatch.app",
icon=macos_icon,
icon=icon,
bundle_identifier="ActivityWatch",
info_plist={"CFBundleExecutable": "MacOS/aw-qt",
"CFBundleShortVersionString": aw_core.__about__.__version__,
"CFBundleVersion": aw_core.__about__.__version__ })
"CFBundleIconFile": "logo.icns",
# TODO: Get the right version here
"CFBundleShortVersionString": "0.8.4"})
import subprocess
subprocess.run("dmgbuild -s config/dmgbuild-settings.py dist/ActivityWatch.app dist/ActivityWatch.dmg", shell=True)
# dmgbuild -s dmgbuild-settings.py dist/ActivityWatch.app dist/ActivityWatch.dmg

0 comments on commit 90183cd

Please sign in to comment.