File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change 168
168
notfound_urls_prefix = "/"
169
169
170
170
# Dynamically expose the Python version associated with the "main" branch.
171
- # The release cycle data may not be ordered, so choose the numerically highest
172
- # version key instead of relying on a specific entry's position.
171
+ # Exactly one entry in ``release-cycle.json`` should have ``"branch": "main"``.
173
172
with open ("include/release-cycle.json" , encoding = "UTF-8" ) as _f :
174
173
_cycle = json .load (_f )
175
- _main_version = max (
176
- _cycle ,
177
- key = lambda v : tuple (int (part ) for part in v .split ("." )),
178
- )
174
+
175
+ _main_entries = [v for v , d in _cycle .items () if d .get ("branch" ) == "main" ]
176
+ if len (_main_entries ) != 1 :
177
+ raise RuntimeError (
178
+ "release-cycle.json must contain exactly one entry with 'branch': 'main'"
179
+ )
180
+
181
+ _main_version = _main_entries [0 ]
179
182
180
183
# prolog and epilogs
181
184
rst_prolog = f"""
You can’t perform that action at this time.
0 commit comments