Merge pull request #127959 from NousResearch/fix/desktop-native-quad-epoch
fix(desktop): use admitted release epoch for Windows native version
This commit is contained in:
@@ -19,8 +19,8 @@ def run(argv: list[str], *, cwd: Path, env: dict[str, str]) -> None:
|
||||
subprocess.run(argv, cwd=cwd, env=env, check=True)
|
||||
|
||||
|
||||
def capture(argv: list[str], repo: Path) -> str:
|
||||
return subprocess.check_output(argv, cwd=repo, text=True, encoding="utf-8").strip()
|
||||
def capture(argv: list[str], repo: Path, env: dict[str, str]) -> str:
|
||||
return subprocess.check_output(argv, cwd=repo, env=env, text=True, encoding="utf-8").strip()
|
||||
|
||||
|
||||
def release_version(_repo: Path, tag: str) -> str:
|
||||
@@ -98,7 +98,7 @@ def _build_prepared(prepared, builder_args: list[str], variant: str | None) -> N
|
||||
version_args = []
|
||||
if sys.platform == "win32" and request.channel_request is None and request.tag is not None:
|
||||
script = "const m=require('./scripts/msix-shared.mjs');console.log(m.nativeQuad(process.argv[1], Number(process.env.HERMES_RELEASE_EPOCH)))"
|
||||
quad = capture([node, "-e", script, request.tag], repo).strip()
|
||||
quad = capture([node, "-e", script, request.tag], repo, env)
|
||||
version_args = [f'-c.extraMetadata.shortVersion={quad}', f'-c.extraMetadata.shortVersionWindows={quad}']
|
||||
require_source(repo, request.commit)
|
||||
run([node, "scripts/run-electron-builder.mjs", *package_args, *version_args, *builder_args], cwd=desktop,
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import sys
|
||||
@@ -65,6 +66,15 @@ def test_stable_build_accepts_the_admitted_commit_before_the_final_tag_exists(tm
|
||||
)
|
||||
|
||||
|
||||
def test_native_version_capture_uses_admitted_build_environment(tmp_path, monkeypatch):
|
||||
from scripts.bundles.desktop import capture
|
||||
|
||||
monkeypatch.delenv("HERMES_RELEASE_EPOCH", raising=False)
|
||||
env = {**os.environ, "HERMES_RELEASE_EPOCH": "1787965323"}
|
||||
script = "import os; print(os.environ['HERMES_RELEASE_EPOCH'])"
|
||||
assert capture([sys.executable, "-c", script], tmp_path, env) == env["HERMES_RELEASE_EPOCH"]
|
||||
|
||||
|
||||
def test_stable_build_rejects_a_claim_tag_for_another_version(tmp_path, monkeypatch):
|
||||
from scripts.bundles.desktop_prepare import BuildRequest
|
||||
|
||||
|
||||
Reference in New Issue
Block a user