Skip to content

Commit 0aa4645

Browse files
committed
DOC: Validate versions.json before building docs pandas-dev#61573
1 parent cfe54bd commit 0aa4645

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

web/pandas_web.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,17 @@ def get_context(config_fname: str, **kwargs):
397397
context["source_path"] = os.path.dirname(config_fname)
398398
context.update(kwargs)
399399

400+
# Validate versions.json
401+
versions_path = os.path.join(context["source_path"], "versions.json")
402+
sys.stderr.write(f"[DEBUG] Checking JSON at {versions_path}\n")
403+
if os.path.exists(versions_path):
404+
try:
405+
with open(versions_path, encoding="utf-8") as f:
406+
json.load(f)
407+
except json.JSONDecodeError as e:
408+
sys.stderr.write(f"\n[ERROR] Invalid JSON in {versions_path}:\n{e}\n")
409+
sys.exit(1)
410+
400411
preprocessors = (
401412
get_callable(context_prep)
402413
for context_prep in context["main"]["context_preprocessors"]

0 commit comments

Comments
 (0)