22# GNU 'make' file
33#
44
5+ # Change to your own Apple Developer ID, if you want to code-sign the resultant .app
6+ DEVID ?= Developer ID Application: Perry Kundert (ZD8TVTCXDS)
7+ # DEVID ?= 3rd Party Mac Developer Application: Perry Kundert (ZD8TVTCXDS)
8+ BUNDLEID ?= ca.kundert.perry.SLIP39
9+
510# PY[3] is the target Python interpreter. It must have pytest installed.
6- PY3 = python3
11+ PY3 ?= python3
712
813VERSION =$(shell $(PY3 ) -c 'exec(open("slip39/version.py") .read()); print( __version__ )')
914
1015# To see all pytest output, uncomment --capture=no
11- PYTESTOPTS =-vv # --capture=no --log-cli-level=INFO
16+ PYTESTOPTS = -vv # --capture=no --log-cli-level=INFO
17+
18+ PY3TEST = $(PY3 ) -m pytest $(PYTESTOPTS )
1219
13- PY3TEST=TZ = $( TZ ) $( PY3 ) -m pytest $( PYTESTOPTS )
20+ .PHONY : all help test doctest analyze pylint build-check build install upload clean FORCE
1421
15- .PHONY : all test clean upload
16- all : help
22+ all : help
1723
1824help :
1925 @echo " GNUmakefile for cpppo. Targets:"
2026 @echo " help This help"
2127 @echo " test Run unit tests under Python3"
28+ @echo " build Build dist wheel and app under Python3"
2229 @echo " install Install in /usr/local for Python3"
2330 @echo " clean Remove build artifacts"
2431 @echo " upload Upload new version to pypi (package maintainer only)"
@@ -42,25 +49,52 @@ pylint:
4249
4350build-check :
4451 @$(PY3 ) -m build --version \
45- || ( echo " \n*** Missing Python modules; run:\n\n $( PY3) -m pip install --upgrade pip setuptools build\n" \
52+ || ( echo " \n*** Missing Python modules; run:\n\n $( PY3) -m pip install --upgrade pip setuptools wheel build\n" \
4653 && false )
4754
48- build : build-check clean
55+ build : clean wheel app
56+
57+ wheel : dist/slip39-$(VERSION ) -py3-none-any.whl
58+
59+ dist/slip39-$(VERSION ) -py3-none-any.whl : build-check FORCE
4960 $(PY3 ) -m build
5061 @ls -last dist
5162
52- dist/slip39-$(VERSION ) -py3-none-any.whl : build
63+ # Install from wheel, including all optional extra dependencies
64+ install : dist/slip39-$(VERSION ) -py3-none-any.whl FORCE
65+ $(PY3 ) -m pip install --force-reinstall $^ [gui,serial,json]
5366
54- install : dist/slip39- $( VERSION ) -py3-none-any.whl
55- $( PY3 ) -m pip install --force-reinstall $^
67+ # Generate, Sign and Zip the App package TODO: Code signing w/ Apple Developer ID
68+ app : dist/SLIP39.app- $( VERSION ) .zip
5669
70+ # (cd dist; zip -r SLIP39.app-$(VERSION).zip SLIP39.app)
71+ # Create a ZIP archive suitable for notarization.
72+ dist/SLIP39.app-$(VERSION ) .zip : dist/SLIP39.app
73+ rm -f $@
74+ /usr/bin/ditto -c -k --keepParent " $( PWD) /$<" " $( PWD) /$@ "
75+ @ls -last dist
76+
77+ # Rebuild the app; ensure we discard any partial/prior build and app artifacts
78+ # --codesign-identity "$(DEVID)" # Nope; must change CFBundleShottVersionString before signing? Also different team IDs?
79+ dist/SLIP39.app : SLIP39.py FORCE
80+ rm -rf build $@ *
81+ pyinstaller --noconfirm --windowed --onefile \
82+ --osx-bundle-identifier " $( BUNDLEID) " \
83+ --collect-data shamir_mnemonic $<
84+ sed -i " " -e " s/0.0.0/$( VERSION) /" " $@ /Contents/Info.plist"
85+ cat $@ /Contents/Info.plist
86+ codesign --force -s " $( DEVID) " $@
5787
5888# Support uploading a new version of slip32 to pypi. Must:
5989# o advance __version__ number in slip32/version.py
6090# o log in to your pypi account (ie. for package maintainer only)
6191
62- upload : build
63- python3 -m twine upload --repository pypi dist/*
92+ upload-check :
93+ @$(PY3 ) -m twine --version \
94+ || ( echo " \n*** Missing Python modules; run:\n\n $( PY3) -m pip install --upgrade twine\n" \
95+ && false )
96+ upload : upload-check wheel
97+ python3 -m twine upload --repository pypi dist/slip39-$(VERSION ) *
6498
6599clean :
66100 @rm -rf MANIFEST * .png build dist auto * .egg-info $(shell find . -name '* .pyc' -o -name '__pycache__' )
0 commit comments