Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 2096b28

Browse files
authored
DOC: Validate versions.json before building docs #61573 (#61578)
1 parent e6da5f2 commit 2096b28

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
@@ -441,6 +441,16 @@ def main(
441441
For ``.md`` and ``.html`` files, render them with the context
442442
before copying them. ``.md`` files are transformed to HTML.
443443
"""
444+
# Sanity check: validate that versions.json is valid JSON
445+
versions_path = os.path.join(source_path, "versions.json")
446+
with open(versions_path, encoding="utf-8") as f:
447+
try:
448+
json.load(f)
449+
except json.JSONDecodeError as e:
450+
raise RuntimeError(
451+
f"Invalid versions.json: {e}. Ensure it is valid JSON."
452+
) from e
453+
444454
config_fname = os.path.join(source_path, "config.yml")
445455

446456
shutil.rmtree(target_path, ignore_errors=True)

0 commit comments

Comments
 (0)