58 @brief Initialize one declared template and verify every managed file was copied faithfully.
59 @param[in] template_name Top-level example directory name.
60 @param[in] temporary_root Temporary parent directory for initialized cases.
63 source = REPO_ROOT /
"examples" / template_name
64 destination = temporary_root / template_name
65 result =
run_cli([
"init", template_name,
"--dest", str(destination)])
67 fail(f
"picurv init {template_name}", result)
68 for source_path
in source.rglob(
"*"):
69 if not source_path.is_file():
71 relative = source_path.relative_to(source)
72 if relative.as_posix() == RUNTIME_EXECUTION_EXAMPLE:
74 copied_path = destination / relative
75 if not copied_path.is_file()
or copied_path.read_bytes() != source_path.read_bytes():
76 raise RuntimeError(f
"picurv init {template_name} did not faithfully copy {relative}")
77 if (destination / RUNTIME_EXECUTION_EXAMPLE).exists():
78 raise RuntimeError(f
"picurv init {template_name} copied site-specific {RUNTIME_EXECUTION_EXAMPLE}")
83 @brief Run the starter-content inventory, composition, and initializer audit.
84 @return Process status code.
86 contract = json.loads(CONTRACT_PATH.read_text(encoding=
"utf-8"))
87 actual_templates = sorted(path.name
for path
in (REPO_ROOT /
"examples").iterdir()
if path.is_dir())
88 if actual_templates != sorted(contract[
"template_directories"]):
89 raise RuntimeError(f
"Template inventory differs from contract: actual={actual_templates}")
90 unknown_reference_templates = set(contract[
"reference_only_templates"]) - set(actual_templates)
91 if unknown_reference_templates:
92 raise RuntimeError(f
"Reference-only templates are not in the template inventory: {sorted(unknown_reference_templates)}")
94 actual_config_assets = sorted(str(path.relative_to(REPO_ROOT))
for path
in (REPO_ROOT /
"config").rglob(
"*")
if path.is_file())
95 if actual_config_assets != sorted(contract[
"config_assets"]):
96 raise RuntimeError(
"Configuration asset inventory differs from the starter-content contract.")
98 declared_example_yamls = set(contract[
"auxiliary_example_yamls"])
99 for bundle
in contract[
"case_bundles"] + contract[
"study_bundles"]:
100 declared_example_yamls.update(path
for path
in bundle.values()
if path.startswith(
"examples/"))
101 actual_example_yamls = {str(path.relative_to(REPO_ROOT))
for path
in (REPO_ROOT /
"examples").rglob(
"*.yml")}
102 if actual_example_yamls != declared_example_yamls:
103 raise RuntimeError(
"Example YAML inventory differs from the declared runnable/reference compositions.")
105 for bundle
in contract[
"case_bundles"]:
107 for bundle
in contract[
"config_role_bundles"]:
109 for bundle
in contract[
"study_bundles"]:
112 with tempfile.TemporaryDirectory(prefix=
"picurv-starter-content-")
as temporary_directory:
113 temporary_root = Path(temporary_directory)
114 for template_name
in contract[
"template_directories"]:
117 print(
"Starter template, example, and configuration audit passed.")
None audit_template_copy(str template_name, Path temporary_root)
Initialize one declared template and verify every managed file was copied faithfully.
None fail(str context, subprocess.CompletedProcess[str] result)
Raise a compact error that preserves the relevant CLI output.
subprocess.CompletedProcess[str] run_cli(list[str] args, Path cwd=REPO_ROOT)
Run one CLI command used to validate a shipped starter artifact.
int main()
Run the starter-content inventory, composition, and initializer audit.
None validate_bundle(dict[str, str] bundle, str label)
Validate one declared case/solver/monitor/post or cluster/study composition.