1
1
#! /bin/bash
2
2
# Builds a macOS app in a DMG container using PyInstaller and an app launcher.
3
- # usage:
4
- # osx_build_app.sh AppName [AppVersion]
3
+ # usage (append e.g. "App" to name to avoid naming conflicts with the library):
4
+ #
5
+ # osx_build_app.sh AppNameApp [AppVersion]
5
6
#
6
7
# Notes:
7
- # - AppVersion is optional (only used for name of DMG container)
8
+ # - AppVersion is optional (used for name of DMG container)
8
9
# - This script must be called from the root directory of the repository
9
10
# - The file ./travis/AppNameApp.py [sic] must be present (relative
10
11
# to root of the repository)
21
22
NAMEVERSION=${1} _${2}
22
23
fi
23
24
24
- # append "App" to avoid naming conflicts with python library
25
25
SCRIPT=" .travis/${NAME} .py"
26
26
APP=" ./dist_app/${NAME} .app"
27
27
DMG=" ./dist_app/${NAMEVERSION} .dmg"
28
+ PKG=" ./dist_app/${NAME} .pkg"
28
29
TMP=" ./dist_app/pack.temp.dmg"
29
- pip install pyinstaller
30
30
31
31
# cleanup from previous builds
32
32
rm -rf ./build
33
33
rm -rf ./dist_app
34
34
35
+ pip install pyinstaller
36
+
35
37
# Work in a different directory (./dist_app instead of ./dist),
36
38
# otherwise PyPI deployment on travis-CI tries to upload *.dmg files.
37
39
pyinstaller -w -y --distpath=" ./dist_app" --additional-hooks-dir=" .travis" $SCRIPT
38
40
41
+ # Create PKG (pkgbuild is for deployments in app stores)
42
+ # https://www.manpagez.com/man/1/productbuild/
43
+ # productbuild --install-location /Applications/ --component ${APP} ${PKG}
44
+ # https://www.manpagez.com/man/1/pkgbuild/
45
+ pkgbuild --install-location /Applications/ --component ${APP} ${PKG}
46
+
47
+ # Create DMG
39
48
# add link to Applications
40
49
mkdir ./dist_app/ui-release
41
50
cd ./dist_app/ui-release
@@ -56,3 +65,4 @@ hdiutil convert "${TMP}" -format UDZO -imagekey zlib-level=9 -o "${DMG}"
56
65
# remove temporary DMG
57
66
rm $TMP
58
67
68
+
0 commit comments