Skip to content

Commit c234c31

Browse files
committed
Try to detect the correct PLATFORM and installer: target
1 parent bcb5c5e commit c234c31

File tree

3 files changed

+29
-23
lines changed

3 files changed

+29
-23
lines changed

GNUmakefile

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,15 @@ SIGNTOOL ?= "c:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x86\signtoo
3030

3131
# PY[3] is the target Python interpreter; require 3.9+. Detect if it is named python3 or python.
3232
PY3 ?= $(shell python3 --version >/dev/null 2>&1 && echo python3 || echo python )
33-
3433
VERSION = $(shell $(PY3) -c 'exec(open("slip39/version.py").read()); print( __version__ )')
34+
PLATFORM ?= $(shell $(PY3) -c "import sys; print( sys.platform )" )
35+
ifeq ($(PLATFORM),darwin)
36+
INSTALLER := dmg
37+
else ifeq ($(PLATFORM),win32)
38+
INSTALLER := msi
39+
else
40+
INSTALLER :=
41+
endif
3542

3643
# To see all pytest output, uncomment --capture=no
3744
PYTESTOPTS = -vv # --capture=no --log-cli-level=INFO
@@ -63,7 +70,8 @@ help:
6370
@echo " install Install in /usr/local for Python3"
6471
@echo " upload Upload new version to pypi (package maintainer only)"
6572
@echo " app Build the macOS SLIP-39.app"
66-
@echo " app-packages Build and sign the macOS SLIP-39.app, and all App zip, dmg and pkg format packages"
73+
@echo " installer Build the .dmg, .msi, as appropriate for PLATFORM"
74+
@echo " print-PLATFORM prints the detected PLATFORM"
6775

6876
test:
6977
$(PY3TEST)
@@ -89,10 +97,7 @@ build-check:
8997
signing-check:
9098
$(SIGNTOOL)
9199

92-
build: clean wheel app
93-
94-
# All the build dependencies that are dynamically deduced
95-
build-deps: build-deps-txt
100+
build: clean wheel
96101

97102
#
98103
# org-mode products.
@@ -104,20 +109,20 @@ build-deps: build-deps-txt
104109

105110
GUI_TXT = $(patsubst %.org,%.txt,$(wildcard slip39/gui/*.org))
106111

107-
build-deps-txt: $(GUI_TXT) slip39/gui/SLIP-39.txt
108-
109112
slip39/gui/SLIP-39.txt:
110113
toilet --font ascii12 SLIP-39 > $@
111114
@echo " Safe & Effective (tm) Crypto Wallet Backup and Recovery" >> $@
112115

116+
# Any build dependencies that are dynamically generated, and may need updating from time to time
117+
build-deps: $(GUI_TXT) slip39/gui/SLIP-39.txt
118+
113119
#
114120
# VirtualEnv build, install and activate
115121
#
116122

117123
venv: $(VENV_LOCAL)/$(VENV_NAME)
118124
venv-activate: $(VENV_LOCAL)/$(VENV_NAME)-activate
119125

120-
121126
$(VENV_LOCAL)/$(VENV_NAME):
122127
@git diff --quiet || ( \
123128
echo -e "\n\n!!! Git repo branch $(GHUB_BRCH) is dirty; cannot create venv!"; false \
@@ -143,9 +148,9 @@ $(VENV_LOCAL)/$(VENV_NAME)-activate: $(VENV_LOCAL)/$(VENV_NAME)
143148
@bash --init-file $</venv-activate.sh -i
144149

145150

146-
wheel: dist/slip39-$(VERSION)-py3-none-any.whl
151+
wheel: build-deps dist/slip39-$(VERSION)-py3-none-any.whl
147152

148-
dist/slip39-$(VERSION)-py3-none-any.whl: build-check build-deps FORCE
153+
dist/slip39-$(VERSION)-py3-none-any.whl: build-check FORCE
149154
$(PY3) -m build
150155
@ls -last dist
151156

@@ -156,10 +161,14 @@ install-dev:
156161
install: dist/slip39-$(VERSION)-py3-none-any.whl FORCE
157162
$(PY3) -m pip install --force-reinstall $<[gui,dev,serial,wallet]
158163

159-
# Building / Signing / Notarizing and Uploading the macOS App
164+
165+
# Building / Signing / Notarizing and Uploading the macOS or win32 App
160166
# o TODO: no signed and notarized package yet accepted for upload by macOS App Store
161-
msi: dist/slip39-$(VERSION)-win64.msi
162-
app: dist/SLIP-39.app
167+
installer: $(INSTALLER)
168+
169+
dmg: build-deps app-dmg-valid
170+
msi: build-deps dist/slip39-$(VERSION)-win64.msi
171+
app: build-deps dist/SLIP-39.app
163172

164173
app-packages: app-zip-valid app-dmg-valid app-pkg-valid
165174
app-upload: app-dmg-upload
@@ -182,7 +191,7 @@ app-pkg-upload: dist/SLIP-39-$(VERSION).pkg.upload-package
182191
#
183192
# Build the windows .msi installer. Must build and sign the .exe first
184193
#
185-
build/exe.$(CXFREEZE_EXT)/SLIP-39.exe: build-deps
194+
build/exe.$(CXFREEZE_EXT)/SLIP-39.exe:
186195
echo -e "\n\n*** Building $@"
187196
@$(PY3) setup.py build_exe > cx_Freeze.build_exe.log \
188197
&& echo -e "\n\n*** $@ Build successfully:" \
@@ -509,8 +518,7 @@ dist/SLIP-39.app-checkids: SLIP-39.spec
509518
# you find the one with the matching fingerprint. Grr... Repeat 'til check-signature works.
510519
dist/SLIP-39.app: SLIP-39-macOS.spec \
511520
SLIP-39.metadata/entitlements.plist \
512-
images/SLIP-39.icns \
513-
build-deps
521+
images/SLIP-39.icns
514522
@echo -e "\n\n*** Rebuilding $@, version $(VERSION)..."
515523
rm -rf build $@*
516524
sed -I "" -E "s/version=.*/version='$(VERSION)',/" $<
@@ -625,9 +633,7 @@ upload: upload-check wheel
625633
python3 -m twine upload --repository pypi dist/slip39-$(VERSION)*
626634

627635
clean:
628-
@rm -rf MANIFEST *.png build dist auto *.egg-info \
629-
$(shell find . -name '__pycache__' ) \
630-
$(shell find . -name '*.pyc' )
636+
@rm -rf MANIFEST *.png build dist auto *.egg-info $(shell find . -name '__pycache__' )
631637

632638

633639
# Run only tests with a prefix containing the target string, eg test-blah

SLIP-39-macOS.spec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ coll = COLLECT(exe,
5050
app = BUNDLE(coll,
5151
name='SLIP-39.app',
5252
icon='images/SLIP-39.icns',
53-
version='8.1.1',
53+
version='8.1.2',
5454
info_plist={
55-
'CFBundleVersion':'8.1.1',
55+
'CFBundleVersion':'8.1.2',
5656
'CFBundlePackageType':'APPL',
5757
'LSApplicationCategoryType':'public.app-category.finance',
5858
'LSMinimumSystemVersion':'10.15.0',

slip39/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
__version_info__ = ( 8, 1, 1 )
1+
__version_info__ = ( 8, 1, 2 )
22
__version__ = '.'.join( map( str, __version_info__ ))

0 commit comments

Comments
 (0)