Skip to content

Commit 4c3cc05

Browse files
committed
Attempt to make progress on macOS code signing
1 parent 762be69 commit 4c3cc05

File tree

11 files changed

+173
-141
lines changed

11 files changed

+173
-141
lines changed

Makefile

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ APPID ?= 1608360813
2222
#DEVID ?= DDB5489E29389E9081E0A2FD83B6555D1B101829
2323
#DEVID ?= 3rd Party Mac Developer Application: Perry Kundert ($(TEAMID))
2424
#DEVID ?= A5DE932A0649AE3B6F06A8134F3E19D2E19A8196
25-
# Developer ID Application (not for Mac App Store)
26-
DEVID ?= EAA134BE299C43D27E33E2B8645FF4CF55DE8A92
27-
28-
#PKGID ?= 3rd Party Mac Developer Installer: Perry Kundert ($(TEAMID))
29-
#PKGID ?= 1B482CEB543825C33C366A5665B935D3CEC9FD05
25+
# Developer ID Application (not for Mac App Store) (exp. Friday, November 10, 2028 at 14:19:34 Mountain Standard Time)
26+
#DEVID ?= EAA134BE299C43D27E33E2B8645FF4CF55DE8A92
27+
# 3rd Party Mac Developer Application; for signing for Mac App Store
28+
DEVID ?= AAEEBB68998F340D00A05926C67D77980D562856
3029

3130
PKGID ?= Developer ID Installer: Perry Kundert ($(TEAMID))
32-
31+
#PKGID ?= CC8AA39695DCC81F0DD56063EBCF033DC2529CC7
32+
#PKGID ?= 3rd Party Mac Developer Installer: Perry Kundert ($(TEAMID))
3333

3434
BUNDLEID ?= ca.kundert.perry.SLIP39
3535
APIISSUER ?= 5f3b4519-83ae-4e01-8d31-f7db26f68290
@@ -49,7 +49,11 @@ SIGNTOOL ?= "c:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x86\signtoo
4949

5050
NIX_OPTS ?= # --pure
5151

52-
# PY[3] is the target Python interpreter; require 3.11+. Detect if it is named python3 or python, and if system, nix or venv-supplied.
52+
# PY[3] is the target Python interpreter; require 3.11+. Detect if it is named python3 or python,
53+
# and if system, nix or venv-supplied. NOTE: Don't try to provide a full path to a Python
54+
# interpreter as the PYTHON variable, as this will interfere with properly using the venv-supplied
55+
# python. Instead, alter the PATH variable so the 'make' invocation sees the correct target Python.
56+
5357
PYTHON ?= $(shell python3 --version >/dev/null 2>&1 && echo python3 || echo python )
5458
PYTHON_P = $(shell which $(PYTHON))
5559
PYTHON_V = $(shell $(PYTHON) -c "import sys; print('-'.join((('venv' if sys.prefix != sys.base_prefix else next(iter(filter(None,sys.base_prefix.split('/'))))),sys.platform,sys.implementation.cache_tag)))" 2>/dev/null )
@@ -65,7 +69,7 @@ else
6569
endif
6670

6771
# To see all pytest output, uncomment --capture=no, ...
68-
PYTEST_OPTS ?= -v # --log-cli-level=WARNING --capture=no # --doctest-modules
72+
PYTEST_OPTS ?= -vv # --capture=no --log-cli-level=INFO # --doctest-modules
6973

7074
PYTEST = $(PYTHON) -m pytest $(PYTEST_OPTS)
7175

@@ -373,24 +377,29 @@ $(VENV):
373377
wheel: deps $(WHEEL)
374378

375379
$(WHEEL): FORCE
376-
$(PYTHON) -m pip install -r requirements-tests.txt
380+
$(PYTHON) -m pip install -r requirements-dev.txt
377381
$(PYTHON) -m build
378382
@ls -last dist
379383

380-
# Install from wheel, including all optional extra dependencies (except dev)
384+
# Install from wheel, including all optional extra dependencies (except dev). Always use the venv (or global)
381385
install: $(WHEEL) FORCE
382-
$(PYTHON) -m pip install --force-reinstall $<[all]
386+
$(PYTHON) -m pip install --no-user --force-reinstall $<[all]
383387

384388
install-%: # ...-dev, -tests
385-
$(PYTHON) -m pip install --upgrade -r requirements-$*.txt
389+
$(PYTHON) -m pip install --no-user --upgrade -r requirements-$*.txt
386390

387391

388392
# Building / Signing / Notarizing and Uploading the macOS or win32 App
389393
# o TODO: no signed and notarized package yet accepted for upload by macOS App Store
390394
#
391395
# Mac: To build the .dmg installer, run:
396+
# nix develop
397+
# PYTHON=python3.12 make venv
398+
# - In the venv:
392399
# make clean
393400
# make installer # continue running every couple of minutes 'til the App is notarized
401+
# - Once .pkg is successfully notarized, upload it:
402+
# make app-pkg-upload
394403
#
395404
installer: $(INSTALLER)
396405

@@ -642,7 +651,7 @@ dist/SLIP-39-$(VERSION).zip: dist/SLIP-39.app
642651
codesign -dv -r- $<
643652
codesign -vv $<
644653
rm -f $@
645-
/usr/bin/ditto -c -k --keepParent "$<" "$@"
654+
/usr/bin/ditto -c -k --sequesterRsrc --keepParent "$<" "$@"
646655
@ls -last dist
647656

648657
# Upload and notarize the .zip, unless we've already uploaded it and have a RequestUUID
@@ -777,13 +786,13 @@ dist/SLIP-39.app: SLIP-39-macOS.spec \
777786
$(PROVISION)
778787
@echo -e "\n\n*** Rebuilding $@, version $(VERSION)..."
779788
rm -rf build $@*
780-
sed -I "" -E "s/version=.*/version='$(VERSION)',/" $<
781-
sed -I "" -E "s/'CFBundleVersion':.*/'CFBundleVersion':'$(VERSION)',/" $<
782-
sed -I "" -E "s/codesign_identity=.*/codesign_identity='$(DEVID)',/" $<
789+
sed -i"" -E "s/version=.*/version='$(VERSION)',/" $<
790+
sed -i"" -E "s/'CFBundleVersion':.*/'CFBundleVersion':'$(VERSION)',/" $<
791+
sed -i"" -E "s/codesign_identity=.*/codesign_identity='$(DEVID)',/" $<
783792
pyinstaller --noconfirm $<
784793
#echo "Copying Provisioning Profile..."; rsync -va $(PROVISION) $@/Contents/embedded.provisionprofile
785794
echo "Checking signature (pyinstaller signed)..."; ./SLIP-39.metadata/check-signature $@ || true
786-
codesign --verify --verbose $@
795+
codesign --verify --verbose $@ || echo "Not valid; codesign-ing..."
787796
# codesign --deep --force \
788797
# --all-architectures --options=runtime --timestamp \
789798
# --sign "$(DEVID)" \

SLIP-39-macOS.spec

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,25 +45,26 @@ exe = EXE(
4545
console=False,
4646
disable_windowed_traceback=False,
4747
argv_emulation=False,
48+
#target_arch='universal2', # Requires Python fat binary
4849
target_arch=None,
49-
codesign_identity='EAA134BE299C43D27E33E2B8645FF4CF55DE8A92',
50-
entitlements_file=None,
50+
codesign_identity='AAEEBB68998F340D00A05926C67D77980D562856',
51+
entitlements_file='SLIP-39.metadata/entitlements.plist',
5152
icon='images/SLIP-39.icns',
5253
)
5354

5455
app = BUNDLE(
5556
exe,
5657
name='SLIP-39.app',
5758
icon='images/SLIP-39.icns',
58-
version='11.2.1',
59+
version='14.0.0',
5960
info_plist={
6061
'NSPrincipalClass': 'NSApplication',
6162
'NSAppleScriptEnabled': False,
6263
'LSBackgroundOnly': False,
6364
'NSRequiresAquaSystemAppearance': 'No',
6465
'CFBundleSupportedPlatforms': ['MacOSX'],
6566
'CFBundleIdentifier': 'ca.kundert.perry.SLIP39',
66-
'CFBundleVersion':'11.2.1',
67+
'CFBundleVersion':'14.0.0',
6768
'CFBundlePackageType':'APPL',
6869
'LSApplicationCategoryType':'public.app-category.utilities',
6970
'LSMinimumSystemVersion':'10.15',

SLIP-39.metadata/entitlements.plist

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44
<dict>
55
<key>com.apple.security.files.user-selected.read-write</key> <true/>
66
<!-- These are required for binaries built by PyInstaller -->
7-
<!--
8-
<key>com.apple.security.app-sandbox</key> <true/>
9-
-->
107
<key>com.apple.security.cs.allow-jit</key> <true/>
118
<key>com.apple.security.cs.allow-unsigned-executable-memory</key> <true/>
129
<key>com.apple.security.cs.disable-library-validation</key> <true/>
10+
<!-- The app-sandbox is required by the App Store, but you must ensure console=False -->
11+
<key>com.apple.security.app-sandbox</key> <true/>
1312
</dict>
1413
</plist>

default.nix

Lines changed: 0 additions & 77 deletions
This file was deleted.

flake.lock

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
description = "Python HD Wallet development environment with multiple Python versions";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/25.05";
6+
flake-utils.url = "github:numtide/flake-utils";
7+
};
8+
9+
outputs = { self, nixpkgs, flake-utils }:
10+
flake-utils.lib.eachDefaultSystem (system:
11+
let
12+
pkgs = nixpkgs.legacyPackages.${system};
13+
14+
# Create Python environments with required packages
15+
mkPythonEnv = pythonPkg: pythonPkg.withPackages (ps: with ps; [
16+
pytest
17+
coincurve
18+
scikit-learn
19+
pycryptodome
20+
pynacl
21+
]);
22+
23+
python310Env = mkPythonEnv pkgs.python310;
24+
python311Env = mkPythonEnv pkgs.python311;
25+
python312Env = mkPythonEnv pkgs.python312;
26+
python313Env = mkPythonEnv pkgs.python313;
27+
python314Env = mkPythonEnv pkgs.python314;
28+
29+
in {
30+
# Single development shell with all Python versions
31+
devShells.default = pkgs.mkShell {
32+
buildInputs = with pkgs; [
33+
# Common tools
34+
cacert
35+
git
36+
gnumake
37+
openssh
38+
bash
39+
bash-completion
40+
41+
# All Python versions with packages
42+
#python310Env
43+
python311Env
44+
python312Env
45+
python313Env
46+
#python314Env
47+
];
48+
49+
shellHook = ''
50+
echo "Welcome to the multi-Python development environment!"
51+
echo "Available Python interpreters:"
52+
echo " python (default): $(python --version 2>&1 || echo 'not available')"
53+
#echo " python3.10: $(python3.10 --version 2>&1 || echo 'not available')"
54+
echo " python3.11: $(python3.11 --version 2>&1 || echo 'not available')"
55+
echo " python3.12: $(python3.12 --version 2>&1 || echo 'not available')"
56+
echo " python3.13: $(python3.13 --version 2>&1 || echo 'not available')"
57+
#echo " python3.14: $(python3.14 --version 2>&1 || echo 'not available')"
58+
echo ""
59+
echo "All versions have pytest, coincurve, scikit-learn, pycryptodome, and pynacl installed."
60+
'';
61+
};
62+
});
63+
}

nixpkgs.nix

Lines changed: 0 additions & 4 deletions
This file was deleted.

requirements-tests.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
aiosmtpd >=1.4, <2
2+
numpy
23
build
34
cx_Freeze >=6.12
45
flake8

0 commit comments

Comments
 (0)