@@ -39,11 +39,13 @@ PYTESTOPTS = -vv # --capture=no --log-cli-level=INFO
3939PY3TEST = $(PY3 ) -m pytest $(PYTESTOPTS )
4040
4141# VirtualEnv: Build them in eg. ~/src/python-slip39-1.2.3/
42+ # o Will use the *current* git branch when creating a venv and populating it
43+
4244VENV_LOCAL ?= ~/src/
4345
4446GHUB_NAME = python-slip39
4547GHUB_REPO =
[email protected] :pjkundert/
$(GHUB_NAME ) 46- GHUB_BRCH = -b master
48+ GHUB_BRCH = $( shell git rev-parse --abbrev-ref HEAD )
4749VENV_NAME = $(GHUB_NAME ) -$(VERSION )
4850VENV_OPTS = # --copies # Doesn't help; still references some system libs.
4951
@@ -78,11 +80,11 @@ pylint:
7880
7981build-check :
8082 @$(PY3 ) -m build --version \
81- || (
82- echo " \n*** Missing Python modules; run:" ; \
83- echo " \n\n $( PY3) -m pip install --upgrade pip setuptools wheel build\n" ; \
84- false \
85- )
83+ || ( \
84+ echo -e " \n\n!!! Missing Python modules; run:" ; \
85+ echo -e " \n\n $( PY3) -m pip install --upgrade pip setuptools wheel build\n" ; \
86+ false ; \
87+ )
8688
8789signing-check :
8890 $(SIGNTOOL )
@@ -118,9 +120,12 @@ venv-activate: $(VENV_LOCAL)/$(VENV_NAME)-activate
118120
119121
120122$(VENV_LOCAL ) /$(VENV_NAME ) :
123+ @git diff --quiet || ( \
124+ echo -e " \n\n!!! Git repo branch $( GHUB_BRCH) is dirty; cannot create venv!" ; false \
125+ )
121126 @echo; echo " *** Building $@ VirtualEnv..."
122127 @rm -rf $@ && $(PY3 ) -m venv $(VENV_OPTS ) $@ \
123- && cd $@ && git clone $(GHUB_REPO ) $(GHUB_BRCH ) \
128+ && cd $@ && git clone $(GHUB_REPO ) -b $(GHUB_BRCH ) \
124129 && . ./bin/activate && make -C $(GHUB_NAME ) install-dev install
125130
126131# Activate a given VirtualEnv, and go to its python-slip39 installation
@@ -178,21 +183,21 @@ app-pkg-upload: deps dist/SLIP-39-$(VERSION).pkg.upload-package
178183# Build the windows .msi installer. Must build and sign the .exe first
179184#
180185build/exe.$(CXFREEZE_EXT ) /SLIP-39.exe :
181- echo " \n\n*** Building $@ "
186+ echo -e " \n\n*** Building $@ "
182187 @$(PY3 ) setup.py build_exe > cx_Freeze.build_exe.log \
183- && echo " \n\n*** $@ Build successfully:" \
184- || ( echo " \n\n!!! $@ Build failed:" ; tail -20 cx_Freeze.build_exe.log; false )
188+ && echo -e " \n\n*** $@ Build successfully:" \
189+ || ( echo -e " \n\n!!! $@ Build failed:" ; tail -20 cx_Freeze.build_exe.log; false )
185190
186191dist/slip39-$(VERSION ) -win64.msi : build/exe.$(CXFREEZE_EXT ) /SLIP-39.exe # signing-check
187- # echo "\n\n*** Signing $<"
192+ # echo -e "\n\n*** Signing $<"
188193 # $(SIGNTOOL) sign /v /t \
189194 # http://timestamp.digicert.com \
190195 # /n "$(DEVID)" \
191196 # $<
192- echo " \n\n*** Package $@ "
197+ echo -e " \n\n*** Package $@ "
193198 @$(PY3 ) setup.py bdist_msi > $cx_Freeze .bdist_msi.log \
194- && echo " \n\n*** $@ Build successfully:" \
195- || ( echo " \n\n!!! $@ Build failed:" ; tail -20 cx_Freeze.bdist_msi.log; false )
199+ && echo -e " \n\n*** $@ Build successfully:" \
200+ || ( echo -e " \n\n!!! $@ Build failed:" ; tail -20 cx_Freeze.bdist_msi.log; false )
196201
197202#
198203# Build the macOS App, and create and sign the .dmg file
@@ -203,14 +208,14 @@ dist/slip39-$(VERSION)-win64.msi: build/exe.$(CXFREEZE_EXT)/SLIP-39.exe # signin
203208# - It automatically finds the correct signing key (unkown)
204209#
205210dist/SLIP-39-$(VERSION ) .dmg : dist/SLIP-39.app
206- @echo " \n\n*** Creating and signing DMG $@ ..."
211+ @echo -e " \n\n*** Creating and signing DMG $@ ..."
207212 npx create-dmg --overwrite $<
208213 mv " SLIP-39 $( VERSION) .dmg" " $@ "
209214 @echo " Checking signature..." ; ./SLIP-39.metadata/check-signature $@
210215
211216.PHONY : dist/SLIP-39-$(VERSION ) .dmg-verify
212217dist/SLIP-39-$(VERSION ) .dmg-verify : dist/SLIP-39-$(VERSION ) .dmg
213- @echo " \n\n*** Verifying signing of $<..."
218+ @echo -e " \n\n*** Verifying signing of $<..."
214219 # codesign --verify -v $< \
215220 # || ( echo "!!! Unable to verify codesign: "; codesign --verify -vv $<; false )
216221 spctl --assess --type install --context context:primary-signature -vvv $< || \
@@ -243,13 +248,13 @@ dist/SLIP-39-$(VERSION).dmg.notarization-status: dist/SLIP-39-$(VERSION).dmg.not
243248# Check notarization status 'til Status: success, then staple it to ...dmg, and create ...dmg.valid marker file
244249dist/SLIP-39-$(VERSION ) .dmg.valid : dist/SLIP-39-$(VERSION ) .dmg.notarization-status FORCE
245250 @grep " Status: success" $< || \
246- ( tail -10 $< ; echo " \n\n!!! App not yet notarized; try again in a few seconds..." ; false )
251+ ( tail -10 $< ; echo -e " \n\n!!! App not yet notarized; try again in a few seconds..." ; false )
247252 ( [ -r $@ ] ) \
248- && ( echo " \n\n*** Notarization complete; refreshing $@ " && touch $@ ) \
253+ && ( echo -e " \n\n*** Notarization complete; refreshing $@ " && touch $@ ) \
249254 || ( \
250255 xcrun stapler staple dist/SLIP-39-$(VERSION ) .dmg && \
251256 xcrun stapler validate dist/SLIP-39-$(VERSION ) .dmg && \
252- echo " \n\n*** Notarization attached to $@ " && \
257+ echo -e " \n\n*** Notarization attached to $@ " && \
253258 touch $@ \
254259 )
255260
@@ -259,7 +264,7 @@ dist/SLIP-39-$(VERSION).dmg.valid: dist/SLIP-39-$(VERSION).dmg.notarization-stat
259264# See: https://github.com/fastlane/fastlane/issues/14783
260265dist/SLIP-39-$(VERSION ) .dmg.upload-package : dist/SLIP-39-$(VERSION ) .dmg dist/SLIP-39-$(VERSION ) .dmg.valid FORCE
261266 [ -s $@ ] || ( \
262- echo " \n\n*** Uploading the signed DMG file: $<..." && \
267+ echo -e " \n\n*** Uploading the signed DMG file: $<..." && \
263268 echo " *** Verifying notarization stapling..." && xcrun stapler validate $< && \
264269 echo " *** Checking signature..." && ./SLIP-39.metadata/check-signature $< && \
265270 echo " *** Upload starting for $<..." && \
@@ -273,7 +278,7 @@ dist/SLIP-39-$(VERSION).dmg.upload-package: dist/SLIP-39-$(VERSION).dmg dist/SLI
273278
274279dist/SLIP-39-$(VERSION ) .dmg.upload-app : dist/SLIP-39-$(VERSION ) .dmg dist/SLIP-39-$(VERSION ) .dmg.valid FORCE
275280 [ -s $@ ] || ( \
276- echo " \n\n*** Uploading the signed DMG file: $<..." && \
281+ echo -e " \n\n*** Uploading the signed DMG file: $<..." && \
277282 echo " *** Verifying notarization stapling..." && xcrun stapler validate $< && \
278283 echo " *** Checking signature..." && ./SLIP-39.metadata/check-signature $< && \
279284 echo " *** Upload starting for $<..." && \
@@ -317,7 +322,7 @@ dist/SLIP-39-$(VERSION).pkg: dist/SLIP-39.app
317322
318323.PHONY : dist/SLIP-39-$(VERSION ) .pkg-verify
319324dist/SLIP-39-$(VERSION ) .pkg-verify : dist/SLIP-39-$(VERSION ) .pkg
320- @echo " \n\n*** Verifying signing of $<..."
325+ @echo -e " \n\n*** Verifying signing of $<..."
321326 pkgutil --check-signature $< | grep " Signed with a trusted timestamp"
322327 # pkgutil --check-signature $< | grep "1. Developer ID Installer:"
323328
@@ -344,13 +349,13 @@ dist/SLIP-39-$(VERSION).pkg.notarization-status: dist/SLIP-39-$(VERSION).pkg.not
344349# Check notarization status 'til Status: success, then staple it to ...pkg, and create ...pkg.valid marker file
345350dist/SLIP-39-$(VERSION ) .pkg.valid : dist/SLIP-39-$(VERSION ) .pkg.notarization-status FORCE
346351 @grep " Status: success" $< || \
347- ( tail -10 $< ; echo " \n\n!!! App not yet notarized; try again in a few seconds..." ; false )
352+ ( tail -10 $< ; echo -e " \n\n!!! App not yet notarized; try again in a few seconds..." ; false )
348353 ( [ -r $@ ] ) \
349- && ( echo " \n\n*** Notarization complete; refreshing $@ " && touch $@ ) \
354+ && ( echo -e " \n\n*** Notarization complete; refreshing $@ " && touch $@ ) \
350355 || ( \
351356 xcrun stapler staple dist/SLIP-39-$(VERSION ) .pkg && \
352357 xcrun stapler validate dist/SLIP-39-$(VERSION ) .pkg && \
353- echo " \n\n*** Notarization attached to $@ " && \
358+ echo -e " \n\n*** Notarization attached to $@ " && \
354359 touch $@ \
355360 )
356361
@@ -360,7 +365,7 @@ dist/SLIP-39-$(VERSION).pkg.valid: dist/SLIP-39-$(VERSION).pkg.notarization-stat
360365# o NOTE that --apple-id is NOT your "Apple ID", it is the unique App ID (see above)
361366dist/SLIP-39-$(VERSION ) .pkg.upload-package : dist/SLIP-39-$(VERSION ) .pkg dist/SLIP-39-$(VERSION ) .pkg.valid FORCE
362367 [ -s $@ ] || ( \
363- echo " \n\n*** Uploading the signed PKG file: $<..." && \
368+ echo -e " \n\n*** Uploading the signed PKG file: $<..." && \
364369 echo " *** Verifying notarization stapling..." && xcrun stapler validate $< && \
365370 echo " *** Checking signature..." && ./SLIP-39.metadata/check-signature $< && \
366371 echo " *** Upload starting for $<..." && \
@@ -380,7 +385,7 @@ dist/SLIP-39-$(VERSION).pkg.upload-package: dist/SLIP-39-$(VERSION).pkg dist/SLI
380385# o Create a ZIP archive suitable for notarization.
381386#
382387dist/SLIP-39-$(VERSION ) .zip : dist/SLIP-39.app
383- @echo " \n\n*** Creating and signing DMG $@ ..."
388+ @echo -e " \n\n*** Creating and signing DMG $@ ..."
384389 @echo " Checking signature..." && ./SLIP-39.metadata/check-signature $<
385390 codesign --verify $<
386391 codesign -dv -r- $<
@@ -413,8 +418,8 @@ dist/SLIP-39-$(VERSION).zip.notarization-status: dist/SLIP-39-$(VERSION).zip.no
413418# on the client system, b/c it will check w/ Apple's servers that the app was notarized.
414419dist/SLIP-39-$(VERSION ) .zip.valid : dist/SLIP-39-$(VERSION ) .zip.notarization-status FORCE
415420 @grep " Status: success" $< || \
416- ( tail -10 $< ; echo " \n\n!!! App not yet notarized; try again in a few seconds..." ; false )
417- @echo " \n\n*** Notarization complete; refreshing $@ " \
421+ ( tail -10 $< ; echo -e " \n\n!!! App not yet notarized; try again in a few seconds..." ; false )
422+ @echo -e " \n\n*** Notarization complete; refreshing $@ " \
418423 && touch $@
419424
420425# Submit App Zip w/o notarization stapled.
@@ -435,11 +440,11 @@ dist/SLIP-39-$(VERSION).zip.upload-package: dist/SLIP-39-$(VERSION).zip dist/SLI
435440# o For other purposes (eg. just for manual installation), we can package the Notarized app
436441dist/SLIP-39-$(VERSION ) -notarized.zip : dist/SLIP-39-$(VERSION ) .app dist/SLIP-39-$(VERSION ) .zip.valid
437442 ( [ -r $@ ] ) \
438- && ( echo " \n\n*** Notarization compete; not re-generating $@ " ; true ) \
443+ && ( echo -e " \n\n*** Notarization compete; not re-generating $@ " ; true ) \
439444 || ( \
440445 xcrun stapler staple $< ; \
441446 xcrun stapler validate $< ; \
442- echo " \n\n*** Notarization attached to $<; creating $@ " ; \
447+ echo -e " \n\n*** Notarization attached to $<; creating $@ " ; \
443448 /usr/bin/ditto -c -k --keepParent " $<" " $@ " ; \
444449 ls -last dist; \
445450 )
@@ -474,7 +479,7 @@ dist/SLIP-39-$(VERSION)-notarized.zip.upload: dist/SLIP-39-$(VERSION)-notarized.
474479.PHONY : dist/SLIP-39.app-signed
475480dist/SLIP-39.app-signed : dist/SLIP-39.app \
476481 dist/SLIP-39.app-checkids
477- @echo " \n\n*** Verifying codesigning of $<..."
482+ @echo -e " \n\n*** Verifying codesigning of $<..."
478483 codesign --verify -v $< \
479484 || ( echo " !!! Unable to verify codesign: " ; codesign --verify -vv $< ; false )
480485 spctl --assess --type install --context context:primary-signature -vvv $< || \
@@ -483,7 +488,7 @@ dist/SLIP-39.app-signed: dist/SLIP-39.app \
483488
484489.PHONY : dist/SLIP-39.app-checkids
485490dist/SLIP-39.app-checkids : SLIP-39.spec
486- @echo " \n\n*** Checking Developer/Installer IDs for $( TEAMID) in $<..."
491+ @echo -e " \n\n*** Checking Developer/Installer IDs for $( TEAMID) in $<..."
487492 security find-identity -vp macappstore
488493 security find-identity -vp macappstore | grep " $( DEVID) " \
489494 || ( echo " !!! Unable to find Developer ID for signing: $( DEVID) " ; false )
@@ -505,7 +510,7 @@ dist/SLIP-39.app-checkids: SLIP-39.spec
505510dist/SLIP-39.app : SLIP-39-macOS.spec \
506511 SLIP-39.metadata/entitlements.plist \
507512 images/SLIP-39.icns
508- @echo " \n\n*** Rebuilding $@ , version $( VERSION) ..."
513+ @echo -e " \n\n*** Rebuilding $@ , version $( VERSION) ..."
509514 rm -rf build $@ *
510515 sed -I " " -E " s/version=.*/version='$( VERSION) ',/" $<
511516 sed -I " " -E " s/'CFBundleVersion':.*/'CFBundleVersion':'$( VERSION) ',/" $<
@@ -549,7 +554,7 @@ dist/SLIP-39.app: SLIP-39-macOS.spec \
549554# bundle_identifier='ca.kundert.perry.SLIP39')
550555
551556SLIP-39-macOS.spec : SLIP-39.py
552- @echo " \n\n!!! Rebuilding $@ ; Must be manually edited..."
557+ @echo -e " \n\n!!! Rebuilding $@ ; Must be manually edited..."
553558 pyinstaller --noconfirm --windowed --onefile \
554559 --codesign-identity " $( DEVID) " \
555560 --osx-bundle-identifier " $( BUNDLEID) " \
@@ -568,7 +573,7 @@ dist/SLIP-39.exe: SLIP-39-win32.spec
568573 pyinstaller --noconfirm $<
569574
570575SLIP-39-win32.spec : SLIP-39.py
571- @echo " \n\n!!! Rebuilding $@ ; Must be manually edited..."
576+ @echo -e " \n\n!!! Rebuilding $@ ; Must be manually edited..."
572577 pyinstaller --noconfirm --windowed --onefile \
573578 --collect-data shamir_mnemonic \
574579 --hidden-import slip39 \
@@ -613,7 +618,7 @@ images/SLIP-39.iconset: images/SLIP-39.png
613618#
614619upload-check :
615620 @$(PY3 ) -m twine --version \
616- || ( echo " \n*** Missing Python modules; run:\n\n $( PY3) -m pip install --upgrade twine\n" \
621+ || ( echo -e " \n \n*** Missing Python modules; run:\n\n $( PY3) -m pip install --upgrade twine\n" \
617622 && false )
618623upload : upload-check wheel
619624 python3 -m twine upload --repository pypi dist/slip39-$(VERSION ) *
0 commit comments