File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -13,9 +13,15 @@ The values that are used to populate the templates are found in values.yaml.
1313
1414Rather than modifying the Dockerfiles directly, the ` .j2 ` template should be changed and the Dockerfiles regenerated.
1515
16+ ``` sh
17+ uv run template.py
18+ ```
19+
20+ Or, if you don't have ` uv ` installed:
21+
1622``` sh
1723python3 -m pip install Jinja2 pyyaml
18- python3 template.py values.yaml
24+ python3 template.py
1925```
2026
2127## Notes:
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env -S uv run --script
2+ # /// script
3+ # requires-python = ">=3.12"
4+ # dependencies = [
5+ # "jinja2",
6+ # "pyyaml",
7+ # ]
8+ # ///
19import argparse
210from pathlib import Path
311
@@ -10,7 +18,9 @@ def main():
1018 parser = argparse .ArgumentParser ()
1119 parser .add_argument (
1220 "filename" ,
13- type = argparse .FileType ("r" ),
21+ type = Path ,
22+ nargs = "?" ,
23+ default = Path ("values.yaml" ),
1424 help = "Configuration file, e.g. `values.yaml`" ,
1525 )
1626 parser .add_argument (
@@ -33,7 +43,8 @@ def main():
3343 loader = FileSystemLoader (args .template_dir ), autoescape = select_autoescape ()
3444 )
3545
36- values = yaml .safe_load (args .filename )
46+ with args .filename .open ("r" ) as f :
47+ values = yaml .safe_load (f )
3748 for compiler in values .get ("compilers" , []):
3849 if "arch" in compiler :
3950 target_path = (
You can’t perform that action at this time.
0 commit comments