Skip to content

Commit 93d9d89

Browse files
committed
DOC: Validate versions.json before building docs #61573
1 parent cfe54bd commit 93d9d89

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

web/pandas/versions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,5 @@
4949
"name": "1.0",
5050
"version": "1.0",
5151
"url": "https://pandas.pydata.org/pandas-docs/version/1.0/"
52-
}
52+
},
5353
]

web/pandas_web.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,4 +495,15 @@ def main(
495495
"--target-path", default="build", help="directory where to write the output"
496496
)
497497
args = parser.parse_args()
498+
499+
# Sanity check: validate that versions.json is valid JSON
500+
versions_path = os.path.join(args.source_path, "versions.json")
501+
if os.path.exists(versions_path):
502+
try:
503+
with open(versions_path, encoding="utf-8") as f:
504+
json.load(f)
505+
except json.JSONDecodeError as e:
506+
sys.stderr.write(f"\n[ERROR] Invalid JSON in {versions_path}:\n{e}\n")
507+
sys.exit(1)
508+
498509
sys.exit(main(args.source_path, args.target_path))

0 commit comments

Comments
 (0)