Skip to content

Replace the PowerShell build script with a cross-platform Python driver - #12

Merged
abrignoni merged 2 commits into
mainfrom
chore/build-script
Sep 3, 2026
Merged

abrignoni merged 2 commits into
mainfrom
chore/build-script

Conversation

@abrignoni

@abrignoni abrignoni commented Sep 3, 2026 •

Copy link
Copy Markdown
Owner

Replaces build_exe.ps1 with packaging/build.py, one driver for Windows, macOS, Linux and ARM, in two phases so a signed build is possible.

  • exe runs PyInstaller, one-folder or --onefile. installer runs Inno Setup on Windows; --sign-tool <name> has Inno sign the installer and its uninstaller. all does both, unsigned. verify asserts a signature is present and valid, Authenticode or codesign, with --subject to check the signer. Signing goes between the phases, and all refuses --sign-tool, so an unsigned exe cannot ship inside a signed installer.
  • The spec reads ONEFILE from GLEAPP_ONEFILE instead of being rewritten by every build. clr is now a Windows-only hidden import; on macOS and Linux it logged an ERROR on every build.
  • The installer version comes from gleapp/__init__.py through /DAppVer, and installer.iss refuses to compile without it, so the two cannot drift. PyInstaller is pinned to 6.22.2 in the [build] extra.
  • packaging/entrypoint.py answers --version before the desktop shell loads, so a frozen build can be smoke-tested headless. desktop.main() never handled it, though the comment on its import webview line says it exists for that; I left the comment alone since it is not my file.
  • test_builds.yml builds on all three platforms, checks --version and a real --texworker decode inside the frozen bundle, builds the installer on Windows, and uploads artifacts. Advisory.

Proven on macOS: phase 1 through the driver builds against the edited spec, --version and --texworker both answer headless and exit 0, --onefile produces a single file, the clr error is gone. The driver build is larger than my baseline because it bundles pywebview from the [build] extra, which the baseline environment did not have.

Two follow-ups, not done here. On macOS and Linux the one-file and one-folder outputs are both dist/GLEAPP and collide; --clean avoids it, and a rename touches the installer's folder expectation. The repo mixes CRLF and LF; a .gitattributes would settle it.

Second commit: the lint job now installs the dev extras. tests/test_build_driver.py imports pytest for a skipif, and the job installed only requirements.txt, so pylint reported import-error. A new file has no baseline in the merge-base comparison, so that counted as introduced. Reproduced locally by removing pytest and confirmed cleared by reinstalling it.

🤖 Generated with Claude Code

packaging/build.py drives the build on every platform in two phases so a
signed build is possible: exe (PyInstaller, one-folder or --onefile),
installer (Inno Setup on Windows; --sign-tool NAME has Inno sign the
installer and the uninstaller), all (both, unsigned), and verify (asserts
a code signature is present and valid, Authenticode or codesign). Signing
belongs between the phases, and all refuses --sign-tool so an unsigned
executable cannot ship inside a signed installer.

The spec reads ONEFILE from the GLEAPP_ONEFILE environment variable. The
old script rewrote that line in the tracked spec on every run, so a build
dirtied the tree and the committed default depended on who built last.
clr becomes a Windows-only hidden import; on macOS and Linux it logged an
ERROR on every build for a module that cannot exist there.

installer.iss takes the version from /DAppVer and refuses to compile
without it, and the driver reads it from gleapp/__init__.py as text, so
the installer and the app cannot report different versions. PyInstaller
is pinned to 6.22.2 in the [build] extra, which phase 1 installs.

packaging/entrypoint.py answers --version before the desktop shell is
imported, so a frozen build can be smoke-tested without a window.
desktop.main() never handled it despite a comment saying it does.

test_builds.yml builds on Windows, macOS and Linux, checks --version and a
real --texworker decode inside the frozen bundle, builds the installer on
Windows, and uploads the artifacts. Advisory, so it keeps a paths filter.

Proven on macOS: phase 1 through the driver builds against the edited
spec, --version and --texworker both answer headless, --onefile produces
one file, and the clr ERROR is gone. The driver build is larger than the
baseline because it bundles pywebview from the [build] extra, which the
baseline environment did not have.

Not done here: on macOS and Linux the one-file and one-folder outputs are
both dist/GLEAPP and collide (--clean avoids it; a rename touches the
installer's folder expectation), and the repo mixes CRLF and LF.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
abrignoni added a commit that referenced this pull request Sep 3, 2026
p = pathlib.Path("/tmp/pr12body.txt"); s = p.read_text()
foot = "🤖 Generated with [Claude Code](https://claude.com/claude-code)"
assert foot in s
para = ("Second commit: the lint job now installs the dev extras. `tests/test_build_driver.py` imports `pytest` "
        "for a `skipif`, and the job installed only `requirements.txt`, so pylint reported `import-error`. A new file "
        "has no baseline, so that counted as introduced. Reproduced locally by removing pytest and confirmed cleared "
        "by reinstalling it.\n\n")
p.write_text(s.replace(foot, para + foot, 1)); print("PR body: paragraph inserted before the footer")
PY
gh pr edit 12 --body-file /tmp/pr12body.txt > /dev/null && rm -f /tmp/pr12body.txt && echo "PR #12 body updated"
Install the dev extras in the lint job so new test files resolve pytest

pylint resolves imports against the job's environment, and the test files
import pytest, which lives in the dev extra rather than requirements.txt.
A new test file has no baseline in the merge-base comparison, so an
import it cannot resolve counts as introduced and fails the job.
tests/test_build_driver.py hit it; test_pipeline.py never did because its
import predates the job and is pre-existing on both sides. Reproduced by
removing pytest locally (1 import-error) and reinstalling it (0).

Installs pytest and piexif, the same dev extras test_cases.yml installs.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
pylint resolves imports against the job's environment, and the test files
import pytest, which lives in the dev extra rather than requirements.txt.
A new test file has no baseline in the merge-base comparison, so an
import it cannot resolve counts as introduced and fails the job.
tests/test_build_driver.py hit it; test_pipeline.py never did because its
import predates the job and is pre-existing on both sides. Reproduced by
removing pytest locally (1 import-error) and reinstalling it (0).

Installs pytest and piexif, the same dev extras test_cases.yml installs.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@abrignoni
abrignoni merged commit 6c85b78 into main Sep 3, 2026
11 checks passed
@abrignoni
abrignoni deleted the chore/build-script branch September 3, 2026 04:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant