-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblue
More file actions
executable file
·63 lines (54 loc) · 2.36 KB
/
Copy pathblue
File metadata and controls
executable file
·63 lines (54 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.11"
# dependencies = ["package-doks-blue", "blue", "colors-compute-blue @ git+https://github.com/getcolors/colors-compute.git@7e1c2349388ff2ca8a3da65a0c8cb888315b57f4#subdirectory=blue"]
#
# [tool.uv.sources]
# package-doks-blue = { git = "https://github.com/getcolors/doks.git", rev = "8120674e81d88827c4e8b6eaa899b0c5fbaf829c", subdirectory = "blue" }
# blue = { git = "https://github.com/getcolors/blue.git", rev = "ebab8f233ffca0ac817482ecc3b667813ed9d80e" }
# ///
#
# Managed by `bb pin` — do not edit by hand, and never invent a SHA.
#
# Stamped by `bb pin`. DOKS_LIB_ROOT=/path/to/doks still overrides the
# pin with a working tree.
"""Thin launcher for package-doks-blue.
This file is both the skill payload and the repository entry point:
blue/blue in the repository is a symlink to it. It deliberately holds no
logic of its own: validation, the graph and the steps all live in the
package-doks-blue library, where the test suite reaches them. A copied
payload is the one place in this project where code cannot be tested, so
nothing that can live elsewhere should live here. DOKS_LIB_ROOT names the
repository root; the blue implementation lives under its blue/ directory.
"""
import os
import subprocess
import sys
UNPINNED_ERROR = """\
this launcher carries no doks pin.
It has not been stamped by `bb pin`, which cannot run until the doks
repository has been pushed.
Point it at a checkout meanwhile: DOKS_LIB_ROOT=/path/to/doks
(or run through the repository project: cd doks/blue && uv run python -m package_doks_blue ...)
"""
def _lib_root_project(root: str) -> str:
"""The uv project inside a DOKS_LIB_ROOT checkout: the repository
root or its blue/ implementation both work."""
if os.path.isfile(os.path.join(root, "pyproject.toml")):
return root
return os.path.join(root, "blue")
def main() -> None:
root = os.environ.get("DOKS_LIB_ROOT")
if root:
result = subprocess.run(
["uv", "run", "--project", _lib_root_project(root),
"python", "-m", "package_doks_blue", *sys.argv[1:]])
raise SystemExit(result.returncode)
try:
from package_doks_blue import exec # resolvable only once pinned
except ImportError:
sys.stderr.write(UNPINNED_ERROR)
raise SystemExit(2)
exec()
if __name__ == "__main__":
main()