Skip to content

Commit ff92e0a

Browse files
committed
Fix saving public key when building
1 parent cb3e01e commit ff92e0a

File tree

5 files changed

+16
-7
lines changed

5 files changed

+16
-7
lines changed

.github/workflows/build-executable.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,14 @@ jobs:
233233
pyivf-make_version --outfile "build/version-installer.rc" --version "${{ env.VERSION }}" --file-description "MouseTracks ${{ env.VERSION }}" --internal-name "MouseTracks" --legal-copyright "Peter Hunt" --original-filename "${{ env.FULL_INSTALLER_NAME }}" --product-name "MouseTracks ${{ env.VERSION }}"
234234
deactivate
235235
236+
- name: Write public key
237+
if: runner.os == 'Windows'
238+
shell: bash
239+
run: |
240+
source .venv/Scripts/activate
241+
python launch.py --write-public-key
242+
deactivate
243+
236244
- name: Build executable
237245
shell: bash
238246
run: |
@@ -252,7 +260,6 @@ jobs:
252260
run: |
253261
source .venv/Scripts/activate
254262
echo -n "$PRIVATE_SIGNING_KEY" > keys/private.key
255-
python launch.py --dump-public-key
256263
python launch.py --sign-executable "dist/MouseTracks.exe"
257264
python launch.py --sign-executable "dist/${FULL_EXE_NAME}"
258265
rm keys/private.key

build-nuitka.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ if errorlevel 1 (
7575
)
7676

7777
:: Sign the executables
78-
python launch.py --dump-public-key
78+
python launch.py --write-public-key
7979
python launch.py --sign-executable "dist/MouseTracks.exe"
8080
python launch.py --sign-executable "dist/MouseTracks-%VERSION%-windows-x64.exe"
8181

build-pyinstaller.bat

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,13 @@ mkdir build
3535
pyivf-make_version --outfile "build/version.rc" --version %VERSION% --file-description "MouseTracks %VERSION%" --internal-name "MouseTracks" --original-filename "MouseTracks-%VERSION%-windows-x64.exe" --product-name "MouseTracks %VERSION%" --legal-copyright "Peter Hunt" --company-name "Peter Hunt"
3636
pyivf-make_version --outfile "build/version-installer.rc" --version %VERSION% --file-description "MouseTracks %VERSION%" --internal-name "MouseTracks" --original-filename "MouseTracks.exe" --product-name "MouseTracks %VERSION%" --legal-copyright "Peter Hunt" --company-name "Peter Hunt"
3737

38-
:: Build the executable
38+
:: Write out the public key
39+
python launch.py --write-public-key
40+
41+
:: Build the executable and launcher
3942
pyinstaller MouseTracks.spec
4043

4144
:: Sign the executables
42-
python launch.py --dump-public-key
4345
python launch.py --sign-executable "dist/MouseTracks.exe"
4446
python launch.py --sign-executable "dist/MouseTracks-%VERSION%-windows-x64.exe"
4547

mousetracks2/cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def parse_args(strict: bool = False) -> argparse.Namespace:
5555
privacy_group.add_argument('--no-network', action='store_true', help='disable network tracking')
5656

5757
parser.add_argument('--generate-keys', action='store_true', help=argparse.SUPPRESS)
58-
parser.add_argument('--dump-public-key', action='store_true', help=argparse.SUPPRESS)
58+
parser.add_argument('--write-public-key', action='store_true', help=argparse.SUPPRESS)
5959
parser.add_argument('--show-public-key', action='store_true', help=argparse.SUPPRESS)
6060
parser.add_argument('--sign-executable', metavar='PATH', help=argparse.SUPPRESS)
6161
parser.add_argument('--verify-executable', metavar='PATH', help=argparse.SUPPRESS)
@@ -342,7 +342,7 @@ def run_cli_function() -> bool:
342342
from .sign import generate_keys
343343
generate_keys()
344344

345-
case argparse.Namespace(dump_public_key=True) if sys.platform == 'win32':
345+
case argparse.Namespace(write_public_key=True) if sys.platform == 'win32':
346346
from .sign import write_public_key_to_py
347347
write_public_key_to_py()
348348

mousetracks2/sign.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
PRIVATE_KEY_PATH = KEY_PATH / 'private.key'
2424

25-
PYTHON_KEY_PATH = Path('.').parent / '_sign.py'
25+
PYTHON_KEY_PATH = Path(__file__).parent / '_sign.py'
2626

2727
PUBLIC_KEY_SIZE = 32
2828

0 commit comments

Comments
 (0)