mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 19:08:04 +00:00
Explicitly pin scenarios to a packse commit (#788)
Previously, we just pulled the latest commit from `main` on every update. This causes problems when you do not intend to update the scenarios as in #787. This bumps to the latest `packse` commit without new scenarios.
This commit is contained in:
parent
5e04a95c45
commit
f89c6456e3
2 changed files with 87 additions and 45 deletions
|
@ -22,6 +22,8 @@ import subprocess
|
|||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
PACKSE_COMMIT = "682bf4ff269f130f92bf35fdb58b6b27c94b579a"
|
||||
TOOL_ROOT = Path(__file__).parent
|
||||
TEMPLATE = TOOL_ROOT / "template.mustache"
|
||||
PACKSE = TOOL_ROOT / "packse-scenarios"
|
||||
|
@ -77,12 +79,14 @@ if packse.__development_base_path__.name != "packse":
|
|||
stderr=subprocess.STDOUT,
|
||||
)
|
||||
subprocess.check_call(
|
||||
["git", "checkout"],
|
||||
["git", "checkout", PACKSE_COMMIT],
|
||||
cwd=PACKSE,
|
||||
stdout=subprocess.DEVNULL,
|
||||
stderr=subprocess.STDOUT,
|
||||
)
|
||||
scenarios_path = str(PACKSE / "scenarios")
|
||||
commit = PACKSE_COMMIT
|
||||
|
||||
else:
|
||||
print(
|
||||
f"Using scenarios in packse repository at {packse.__development_base_path__}",
|
||||
|
@ -90,6 +94,19 @@ else:
|
|||
)
|
||||
scenarios_path = str(packse.__development_base_path__ / "scenarios")
|
||||
|
||||
# Get the commit from the repository
|
||||
commit = (
|
||||
subprocess.check_output(
|
||||
["git", "show", "-s", "--format=%H", "HEAD"],
|
||||
cwd=packse.__development_base_path__,
|
||||
)
|
||||
.decode()
|
||||
.strip()
|
||||
)
|
||||
|
||||
if commit != PACKSE_COMMIT:
|
||||
print("WARNING: Expected commit {PACKSE_COMMIT!r} but found {commit!r}.")
|
||||
|
||||
print("Loading scenario metadata...", file=sys.stderr)
|
||||
data = json.loads(
|
||||
subprocess.check_output(
|
||||
|
@ -102,13 +119,6 @@ data = json.loads(
|
|||
)
|
||||
|
||||
# Add generated metadata
|
||||
commit = (
|
||||
subprocess.check_output(
|
||||
["git", "show", "-s", "--format=%H", "HEAD"], cwd=scenarios_path
|
||||
)
|
||||
.decode()
|
||||
.strip()
|
||||
)
|
||||
data["generated_from"] = f"https://github.com/zanieb/packse/tree/{commit}/scenarios"
|
||||
data["generated_with"] = " ".join(sys.argv)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue