Skip to content

Commit f1d80fc

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

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

web/pandas_web.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,16 @@ 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+
if os.path.exists(versions_path):
403+
try:
404+
with open(versions_path, encoding="utf-8") as f:
405+
json.load(f)
406+
except json.JSONDecodeError as e:
407+
sys.stderr.write(f"\n[ERROR] Invalid JSON in {versions_path}:\n{e}\n")
408+
sys.exit(1)
409+
400410
preprocessors = (
401411
get_callable(context_prep)
402412
for context_prep in context["main"]["context_preprocessors"]

0 commit comments

Comments
 (0)