Files
hermes-agent/apps/desktop/scripts/prepare_dmgbuild.py
ethernet 2efa4ff94f refactor(desktop): prepare dependencies before saving build caches
Dependency acquisition during packaging left native wheels and packager
inputs outside the pre-build cache save. Compose PM and existing providers
into a preparation phase, then require builds to consume admitted inputs.

Share native preparation with PM Bundle. Keep path-bound environments and
signing outputs separate from reusable caches. Use read-only cache tokens
for commit builds and preserve the one-command local build path.

Verify pinned tools through PM, probe PTYs under the prepared Electron,
and supply dmgbuild through a build-only PM package. Resolve bundled tool
stores from their payload manifest so relocation preserves discovery.

Validation: focused Python and JS tests, checkJs, Ruff, Windows checks,
anti-slop, cache relocation, and network-denied Linux AppImage builds.
Relocated runtime smoke passed with NixOS host libraries supplied.
Native Windows/macOS signing and live GitHub cache behavior remain untested.
2026-09-13 14:28:31 -04:00

34 lines
1.2 KiB
Python

"""Source-build entrypoint for the independently PM-owned DMG supplier."""
from __future__ import annotations
import argparse
from pathlib import Path
import sys
if __package__ in (None, ""):
sys.path.insert(0, str(Path(__file__).resolve().parents[3]))
def prepare_dmgbuild(out: Path, cache: Path) -> Path:
import pm
from pm import paths
target = pm.current_target()
if not target.startswith("darwin-"):
raise ValueError("dmgbuild preparation requires native macOS")
store = pm.prepare_tools(["dmgbuild"], out=out, target=target, cache=cache)
package = pm.get_package("dmgbuild")
version = pm.Lockfile(paths.lockfile_path()).version(package.name)
assert version is not None # prepare_tools cannot succeed without a lock pin
binary = package.binary(store / package.store_entry(version, target), target)
assert binary is not None # dmgbuild declares its launcher
return binary
if __name__ == "__main__":
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--out", type=Path, required=True)
parser.add_argument("--cache", type=Path, required=True)
args = parser.parse_args()
print(prepare_dmgbuild(args.out, args.cache))