MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / render_homebrew_formula

Function render_homebrew_formula

tasks/scripts/release.py:227–368  ·  view source on GitHub ↗
(
    *,
    release_tag: str,
    cli_sha256: str,
    gateway_sha256: str,
    driver_vm_sha256: str,
)

Source from the content-addressed store, hash-verified

225
226
227def render_homebrew_formula(
228 *,
229 release_tag: str,
230 cli_sha256: str,
231 gateway_sha256: str,
232 driver_vm_sha256: str,
233) -> str:
234 if not _RELEASE_TAG_RE.fullmatch(release_tag):
235 raise ValueError(f"release tag contains unsupported characters: {release_tag}")
236
237 version = release_tag.removeprefix("v")
238 return f"""# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
239# SPDX-License-Identifier: Apache-2.0
240#
241# Generated by tasks/scripts/release.py. Do not edit by hand.
242
243class Openshell < Formula
244 desc "Safe, private runtime for autonomous AI agents"
245 homepage "https://github.com/NVIDIA/OpenShell"
246 url "{_asset_url(release_tag, HOMEBREW_CLI_ASSET)}"
247 sha256 "{cli_sha256}"
248 version "{version}"
249 license "Apache-2.0"
250
251 depends_on macos: :big_sur
252 depends_on arch: :arm64
253
254 resource "openshell-gateway" do
255 url "{_asset_url(release_tag, HOMEBREW_GATEWAY_ASSET)}"
256 sha256 "{gateway_sha256}"
257 end
258
259 resource "openshell-driver-vm" do
260 url "{_asset_url(release_tag, HOMEBREW_DRIVER_VM_ASSET)}"
261 sha256 "{driver_vm_sha256}"
262 end
263
264 def install
265 odie "OpenShell Homebrew formula currently supports macOS only" unless OS.mac?
266
267 bin.install "openshell"
268
269 resource("openshell-gateway").stage do
270 bin.install "openshell-gateway"
271 end
272
273 resource("openshell-driver-vm").stage do
274 libexec.install "openshell-driver-vm"
275 end
276
277 (libexec/"openshell-gateway-homebrew-service").write <<~SH
278 #!/bin/sh
279 set -eu
280
281 if [ -z "${{HOME:-}}" ]; then
282 echo "HOME must be set for Docker TLS bind mounts" >&2
283 exit 1
284 fi

Callers 1

Calls 1

_asset_urlFunction · 0.85

Tested by

no test coverage detected