Lock asset pipeline to free sources
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Fail if tracked Agrarian assets include paid or unclear costs."""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
REGISTER = ROOT / "Docs" / "Art" / "AssetLicenses.md"
|
||||
|
||||
ALLOWED_COSTS = {"free", "$0", "0", "n/a", "na"}
|
||||
BLOCKED_WORDS = {
|
||||
"paid",
|
||||
"purchased",
|
||||
"purchase",
|
||||
"subscription",
|
||||
"unknown",
|
||||
"unclear",
|
||||
"tbd",
|
||||
"marketplace bundle",
|
||||
}
|
||||
|
||||
|
||||
def parse_markdown_table_rows(text: str) -> list[list[str]]:
|
||||
rows: list[list[str]] = []
|
||||
for line in text.splitlines():
|
||||
stripped = line.strip()
|
||||
if not stripped.startswith("|") or "---" in stripped:
|
||||
continue
|
||||
cells = [cell.strip() for cell in stripped.strip("|").split("|")]
|
||||
if cells and cells[0] != "Asset":
|
||||
rows.append(cells)
|
||||
return rows
|
||||
|
||||
|
||||
def main() -> None:
|
||||
if not REGISTER.exists():
|
||||
raise SystemExit(f"Missing asset license register: {REGISTER}")
|
||||
|
||||
rows = parse_markdown_table_rows(REGISTER.read_text(encoding="utf-8"))
|
||||
failures: list[str] = []
|
||||
|
||||
for row in rows:
|
||||
if len(row) < 5:
|
||||
failures.append(f"Malformed asset license row: {' | '.join(row)}")
|
||||
continue
|
||||
|
||||
asset = row[0]
|
||||
cost = row[4].strip().lower()
|
||||
full_row = " ".join(row).lower()
|
||||
|
||||
if not cost:
|
||||
failures.append(f"{asset}: cost is blank")
|
||||
elif cost not in ALLOWED_COSTS:
|
||||
failures.append(f"{asset}: cost {row[4]!r} is not free-only")
|
||||
|
||||
for blocked in BLOCKED_WORDS:
|
||||
if blocked in full_row:
|
||||
failures.append(f"{asset}: blocked free-only word found: {blocked!r}")
|
||||
|
||||
if failures:
|
||||
raise SystemExit("\n".join(failures))
|
||||
|
||||
print(f"Asset license free-only verification complete: {len(rows)} entries.")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -12,12 +12,16 @@ REQUIRED = {
|
||||
"CC0 or public-domain",
|
||||
"/home/nathan/AssetStaging/Agrarian",
|
||||
"Do not import random internet images",
|
||||
"Free-Only Acquisition Gate",
|
||||
"Paid Fab assets are blocked",
|
||||
"Native Ground Zero proxy vegetation",
|
||||
],
|
||||
"Docs/Art/AgrarianAssetPipeline.md": [
|
||||
"realistic modern post-collapse frontier survival",
|
||||
"Old abandoned equipment",
|
||||
"Do not scrape random internet images or models",
|
||||
"Free-Only Lockdown",
|
||||
"Do not click purchase",
|
||||
"LicenseEvidence",
|
||||
"Run visual and placeholder verifiers",
|
||||
"Water should be handled as a shader/system problem",
|
||||
|
||||
Reference in New Issue
Block a user