f3021c4ddb
release / release (push) Successful in 14s
- feat(ci): set each Gitea release body from the matching CHANGELOG section (was hardcoded "Automated release for…") - feat(updater): show "What's new" — release notes dialog before applying (GUI) and in `rigdoctor update` (CLI); fetch_latest/update_state now return notes - feat(gui): "Restart now" button relaunches the app after an update is applied - fix(packaging): build the self-extracting .run with a pure-Python extractor (packaging/make_run.py) instead of makeself, so it attaches to every release (it was silently skipped before) - chore: adopt Conventional Commits + git-cliff (cliff.toml, packaging/ changelog.sh) for changelog generation going forward (D20) - chore(gui): drop internal module refs (M4, M5, …) from Setup descriptions Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
63 lines
1.7 KiB
Python
63 lines
1.7 KiB
Python
#!/usr/bin/env python3
|
|
"""Build a dependency-free self-extracting .run installer (no makeself).
|
|
|
|
Produces dist/rigdoctor-<version>-installer.run: a POSIX shell stub with an appended
|
|
tar.gz of the wheel + install.sh. Running it extracts to a temp dir and runs install.sh.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import io
|
|
import os
|
|
import subprocess
|
|
import sys
|
|
import tarfile
|
|
import tomllib
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parent.parent
|
|
MARKER = "__RIGDOCTOR_ARCHIVE__"
|
|
|
|
STUB = f"""#!/bin/sh
|
|
# RigDoctor self-extracting installer. Extracts the embedded archive and runs install.sh.
|
|
set -eu
|
|
SKIP=$(awk '/^{MARKER}$/ {{ print NR + 1; exit 0 }}' "$0")
|
|
TMP=$(mktemp -d)
|
|
tail -n +"$SKIP" "$0" | tar -xz -C "$TMP"
|
|
sh "$TMP/install.sh" "$@"
|
|
RET=$?
|
|
rm -rf "$TMP"
|
|
exit $RET
|
|
{MARKER}
|
|
"""
|
|
|
|
|
|
def main() -> int:
|
|
version = tomllib.loads((ROOT / "pyproject.toml").read_text())["project"]["version"]
|
|
dist = ROOT / "dist"
|
|
dist.mkdir(exist_ok=True)
|
|
|
|
wheel = dist / f"rigdoctor-{version}-py3-none-any.whl"
|
|
if not wheel.exists():
|
|
subprocess.run([sys.executable, "-m", "build", "--wheel"], cwd=ROOT, check=True)
|
|
if not wheel.exists():
|
|
print(f"wheel not found: {wheel}", file=sys.stderr)
|
|
return 1
|
|
|
|
buf = io.BytesIO()
|
|
with tarfile.open(fileobj=buf, mode="w:gz") as tar:
|
|
tar.add(wheel, arcname=wheel.name)
|
|
tar.add(ROOT / "install.sh", arcname="install.sh")
|
|
|
|
out = dist / f"rigdoctor-{version}-installer.run"
|
|
with open(out, "wb") as f:
|
|
f.write(STUB.encode())
|
|
f.write(buf.getvalue())
|
|
os.chmod(out, 0o755)
|
|
print(f"Built {out}")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|