Add dmg building on MacOS, move build-related stuff to deploy/
This commit is contained in:
parent
e4a6983ed9
commit
68a264f9ba
26
Makefile
26
Makefile
@ -5,6 +5,7 @@ PY_FILES = $(wildcard *.py) $(wildcard gui/*.py)
|
|||||||
UI_COMPILED = $(UI_FILES:.ui=.py)
|
UI_COMPILED = $(UI_FILES:.ui=.py)
|
||||||
TS_COMPILED = $(TS_FILES:.ts=.qm)
|
TS_COMPILED = $(TS_FILES:.ts=.qm)
|
||||||
|
|
||||||
|
# python3.6 on Windows is only available as python.exe
|
||||||
ifeq (, $(shell which python3))
|
ifeq (, $(shell which python3))
|
||||||
PY ?= python
|
PY ?= python
|
||||||
else
|
else
|
||||||
@ -26,13 +27,26 @@ clean:
|
|||||||
run: all
|
run: all
|
||||||
$(PY) luftdaten-tool.py
|
$(PY) luftdaten-tool.py
|
||||||
|
|
||||||
dist: all
|
# Updates all translation files in i18n/ directory
|
||||||
$(PY) -m PyInstaller -y luftdaten-tool.spec
|
i18n-update: $(UI_COMPILED)
|
||||||
|
@for f in $(TS_FILES) ; do \
|
||||||
|
pylupdate5 $(PY_FILES) -ts $$f -verbose; \
|
||||||
|
done
|
||||||
|
|
||||||
deps:
|
deps:
|
||||||
$(PY) -m pip install -U -r requirements.txt
|
$(PY) -m pip install -U -r requirements.txt
|
||||||
|
|
||||||
i18n-update:
|
# Here go platform-specific buildsteps
|
||||||
@for f in $(TS_FILES) ; do \
|
UNAME_S := $(shell uname -s)
|
||||||
pylupdate5 *.py gui/*.py -ts $$f -verbose; \
|
|
||||||
done
|
ifeq ($(UNAME_S),Darwin)
|
||||||
|
PLATFORM_DEPS := assets/logo.icns
|
||||||
|
assets/logo.icns: assets/logo.png
|
||||||
|
deploy/mkicns $<
|
||||||
|
endif
|
||||||
|
|
||||||
|
dist: all $(PLATFORM_DEPS)
|
||||||
|
$(PY) -m PyInstaller -y luftdaten-tool.spec
|
||||||
|
|
||||||
|
dmg: dist
|
||||||
|
dmgbuild -s deploy/dmgbuild_settings.py -D app=dist/Luftdaten.info\ Flashing\ Tool.app "Luftdaten.info Flashing Tool" dist/luftdaten-tool.dmg
|
||||||
|
@ -24,7 +24,7 @@ Currently Windows builds require *Python 3.6* installed system-wide and added to
|
|||||||
`%PATH%`.
|
`%PATH%`.
|
||||||
|
|
||||||
To install python and cygwin dependencies and build everything use
|
To install python and cygwin dependencies and build everything use
|
||||||
`windows-build.bat` batch script.
|
`deploy\windows-build.bat` batch script.
|
||||||
|
|
||||||
### MacOS
|
### MacOS
|
||||||
Currently MacOS builds require *Python 3.6* and Qt SDK installed (just the "Qt >
|
Currently MacOS builds require *Python 3.6* and Qt SDK installed (just the "Qt >
|
||||||
@ -34,7 +34,7 @@ Currently MacOS builds require *Python 3.6* and Qt SDK installed (just the "Qt >
|
|||||||
|
|
||||||
Then just install dependencies and build everything using:
|
Then just install dependencies and build everything using:
|
||||||
|
|
||||||
make deps dist
|
make deps dmg
|
||||||
|
|
||||||
Development
|
Development
|
||||||
-----------
|
-----------
|
||||||
|
BIN
assets/logo.ico
Normal file
BIN
assets/logo.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
BIN
assets/logo.png
BIN
assets/logo.png
Binary file not shown.
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 18 KiB |
174
deploy/dmgbuild_settings.py
Normal file
174
deploy/dmgbuild_settings.py
Normal file
@ -0,0 +1,174 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import biplist
|
||||||
|
import os.path
|
||||||
|
|
||||||
|
#
|
||||||
|
# Example settings file for dmgbuild
|
||||||
|
#
|
||||||
|
|
||||||
|
# Use like this: dmgbuild -s settings.py "Test Volume" test.dmg
|
||||||
|
|
||||||
|
# You can actually use this file for your own application (not just TextEdit)
|
||||||
|
# by doing e.g.
|
||||||
|
#
|
||||||
|
# dmgbuild -s settings.py -D app=/path/to/My.app "My Application" MyApp.dmg
|
||||||
|
|
||||||
|
# .. Useful stuff ..............................................................
|
||||||
|
|
||||||
|
application = defines.get('app', '/Applications/TextEdit.app')
|
||||||
|
appname = os.path.basename(application)
|
||||||
|
|
||||||
|
def icon_from_app(app_path):
|
||||||
|
plist_path = os.path.join(app_path, 'Contents', 'Info.plist')
|
||||||
|
plist = biplist.readPlist(plist_path)
|
||||||
|
icon_name = plist['CFBundleIconFile']
|
||||||
|
icon_root,icon_ext = os.path.splitext(icon_name)
|
||||||
|
if not icon_ext:
|
||||||
|
icon_ext = '.icns'
|
||||||
|
icon_name = icon_root + icon_ext
|
||||||
|
return os.path.join(app_path, 'Contents', 'Resources', icon_name)
|
||||||
|
|
||||||
|
# .. Basics ....................................................................
|
||||||
|
|
||||||
|
# Uncomment to override the output filename
|
||||||
|
# filename = 'test.dmg'
|
||||||
|
|
||||||
|
# Uncomment to override the output volume name
|
||||||
|
# volume_name = 'Test'
|
||||||
|
|
||||||
|
# Volume format (see hdiutil create -help)
|
||||||
|
format = defines.get('format', 'UDBZ')
|
||||||
|
|
||||||
|
# Volume size (must be large enough for your files)
|
||||||
|
size = defines.get('size', '100M')
|
||||||
|
|
||||||
|
# Files to include
|
||||||
|
files = [ application ]
|
||||||
|
|
||||||
|
# Symlinks to create
|
||||||
|
symlinks = { 'Applications': '/Applications' }
|
||||||
|
|
||||||
|
# Volume icon
|
||||||
|
#
|
||||||
|
# You can either define icon, in which case that icon file will be copied to the
|
||||||
|
# image, *or* you can define badge_icon, in which case the icon file you specify
|
||||||
|
# will be used to badge the system's Removable Disk icon
|
||||||
|
#
|
||||||
|
#icon = '/path/to/icon.icns'
|
||||||
|
badge_icon = icon_from_app(application)
|
||||||
|
|
||||||
|
# Where to put the icons
|
||||||
|
icon_locations = {
|
||||||
|
appname: (140, 120),
|
||||||
|
'Applications': (500, 120)
|
||||||
|
}
|
||||||
|
|
||||||
|
# .. Window configuration ......................................................
|
||||||
|
|
||||||
|
# Background
|
||||||
|
#
|
||||||
|
# This is a STRING containing any of the following:
|
||||||
|
#
|
||||||
|
# #3344ff - web-style RGB color
|
||||||
|
# #34f - web-style RGB color, short form (#34f == #3344ff)
|
||||||
|
# rgb(1,0,0) - RGB color, each value is between 0 and 1
|
||||||
|
# hsl(120,1,.5) - HSL (hue saturation lightness) color
|
||||||
|
# hwb(300,0,0) - HWB (hue whiteness blackness) color
|
||||||
|
# cmyk(0,1,0,0) - CMYK color
|
||||||
|
# goldenrod - X11/SVG named color
|
||||||
|
# builtin-arrow - A simple built-in background with a blue arrow
|
||||||
|
# /foo/bar/baz.png - The path to an image file
|
||||||
|
#
|
||||||
|
# The hue component in hsl() and hwb() may include a unit; it defaults to
|
||||||
|
# degrees ('deg'), but also supports radians ('rad') and gradians ('grad'
|
||||||
|
# or 'gon').
|
||||||
|
#
|
||||||
|
# Other color components may be expressed either in the range 0 to 1, or
|
||||||
|
# as percentages (e.g. 60% is equivalent to 0.6).
|
||||||
|
background = 'builtin-arrow'
|
||||||
|
|
||||||
|
show_status_bar = False
|
||||||
|
show_tab_view = False
|
||||||
|
show_toolbar = False
|
||||||
|
show_pathbar = False
|
||||||
|
show_sidebar = False
|
||||||
|
sidebar_width = 180
|
||||||
|
|
||||||
|
# Window position in ((x, y), (w, h)) format
|
||||||
|
window_rect = ((100, 100), (640, 280))
|
||||||
|
|
||||||
|
# Select the default view; must be one of
|
||||||
|
#
|
||||||
|
# 'icon-view'
|
||||||
|
# 'list-view'
|
||||||
|
# 'column-view'
|
||||||
|
# 'coverflow'
|
||||||
|
#
|
||||||
|
default_view = 'icon-view'
|
||||||
|
|
||||||
|
# General view configuration
|
||||||
|
show_icon_preview = False
|
||||||
|
|
||||||
|
# Set these to True to force inclusion of icon/list view settings (otherwise
|
||||||
|
# we only include settings for the default view)
|
||||||
|
include_icon_view_settings = 'auto'
|
||||||
|
include_list_view_settings = 'auto'
|
||||||
|
|
||||||
|
# .. Icon view configuration ...................................................
|
||||||
|
|
||||||
|
arrange_by = None
|
||||||
|
grid_offset = (0, 0)
|
||||||
|
grid_spacing = 100
|
||||||
|
scroll_position = (0, 0)
|
||||||
|
label_pos = 'bottom' # or 'right'
|
||||||
|
text_size = 16
|
||||||
|
icon_size = 128
|
||||||
|
|
||||||
|
# .. List view configuration ...................................................
|
||||||
|
|
||||||
|
# Column names are as follows:
|
||||||
|
#
|
||||||
|
# name
|
||||||
|
# date-modified
|
||||||
|
# date-created
|
||||||
|
# date-added
|
||||||
|
# date-last-opened
|
||||||
|
# size
|
||||||
|
# kind
|
||||||
|
# label
|
||||||
|
# version
|
||||||
|
# comments
|
||||||
|
#
|
||||||
|
list_icon_size = 16
|
||||||
|
list_text_size = 12
|
||||||
|
list_scroll_position = (0, 0)
|
||||||
|
list_sort_by = 'name'
|
||||||
|
list_use_relative_dates = True
|
||||||
|
list_calculate_all_sizes = False,
|
||||||
|
list_columns = ('name', 'date-modified', 'size', 'kind', 'date-added')
|
||||||
|
list_column_widths = {
|
||||||
|
'name': 300,
|
||||||
|
'date-modified': 181,
|
||||||
|
'date-created': 181,
|
||||||
|
'date-added': 181,
|
||||||
|
'date-last-opened': 181,
|
||||||
|
'size': 97,
|
||||||
|
'kind': 115,
|
||||||
|
'label': 100,
|
||||||
|
'version': 75,
|
||||||
|
'comments': 300,
|
||||||
|
}
|
||||||
|
list_column_sort_directions = {
|
||||||
|
'name': 'ascending',
|
||||||
|
'date-modified': 'descending',
|
||||||
|
'date-created': 'descending',
|
||||||
|
'date-added': 'descending',
|
||||||
|
'date-last-opened': 'descending',
|
||||||
|
'size': 'descending',
|
||||||
|
'kind': 'ascending',
|
||||||
|
'label': 'ascending',
|
||||||
|
'version': 'ascending',
|
||||||
|
'comments': 'ascending',
|
||||||
|
}
|
20
deploy/mkicns
Executable file
20
deploy/mkicns
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Builds .icns file from a single .png file
|
||||||
|
#
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
filename="${1%.*}"
|
||||||
|
mkdir "$filename".iconset
|
||||||
|
for i in 16 32 128 256 ; do
|
||||||
|
n=$(( i * 2 ))
|
||||||
|
sips -z $i $i "$1" --out "$filename".iconset/icon_${i}x${i}.png
|
||||||
|
sips -z $n $n "$1" --out "$filename".iconset/icon_${i}x${i}@2x.png
|
||||||
|
[[ $n -eq 512 ]] && \
|
||||||
|
sips -z $n $n "$1" --out "$filename".iconset/icon_${n}x${n}.png
|
||||||
|
(( i++ ))
|
||||||
|
done
|
||||||
|
cp "$1" "$filename".iconset/icon_512x512@2x.png
|
||||||
|
iconutil -c icns "$filename".iconset
|
||||||
|
rm -r "$filename".iconset
|
@ -1,3 +1,5 @@
|
|||||||
|
cd ..
|
||||||
|
|
||||||
if not exist build mkdir build
|
if not exist build mkdir build
|
||||||
|
|
||||||
rem Download cygwin installer
|
rem Download cygwin installer
|
@ -26,10 +26,11 @@ exe = EXE(pyz,
|
|||||||
strip=False,
|
strip=False,
|
||||||
upx=True,
|
upx=True,
|
||||||
runtime_tmpdir=None,
|
runtime_tmpdir=None,
|
||||||
console=False )
|
console=False,
|
||||||
|
icon='assets/logo.ico')
|
||||||
|
|
||||||
# This is used on MacOS only
|
# This is used on MacOS only
|
||||||
app = BUNDLE(exe,
|
app = BUNDLE(exe,
|
||||||
name='Luftdaten.info Flashing Tool.app',
|
name='Luftdaten.info Flashing Tool.app',
|
||||||
icon=None,
|
icon='assets/logo.icns',
|
||||||
bundle_identifier=None)
|
bundle_identifier=None)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user