Skip to content

Commit

Permalink
Tools: Update generate_release_notes_index.py to new versioning scheme
Browse files Browse the repository at this point in the history
We need to handle versions beginning with `"1."` differently from
others. This is because we switched to the new scheme between version
1.31 and version 32.

I was forced to reformat using black.
  • Loading branch information
Anton Schwarz committed Aug 22, 2023
1 parent 58b75f7 commit 33e08d4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
20 changes: 15 additions & 5 deletions tools/generate_release_notes_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ def minor_release_get_title(path: str, version: str) -> str:
:param version: A major and minor version of a release. (e.g. "1.27")
:returns: The coresponsing release title. This is just the version string in
case no title exist.
Note that due to the switch to a new versioning scheme between version
1.31 and 32, we need to handle version strings beginning with "1."
differently.
"""
# We hardcode the minor release titles for now, since there is no easy
# way to automatically get them.
Expand Down Expand Up @@ -85,11 +89,17 @@ def minor_release_get_title(path: str, version: str) -> str:
"1.5": "Return of the Donkey",
"1.4": "The Donkey strikes back",
}
if version in HARD_CODED_RELEASE_NOTE_TITLE:
return version + " " + HARD_CODED_RELEASE_NOTE_TITLE[version]
raise Exception(
f"The minor version {version} is not present in the hardcoded list of minor release titles!" # noqa: E501
)
try:
if version[:2] == "1.":
return version + " " + HARD_CODED_RELEASE_NOTE_TITLE[version]
else:
return (
f"{version} {HARD_CODED_RELEASE_NOTE_TITLE[version.split('.')[0]]}"
)
except KeyError:
raise Exception(
f"Version {version} is not present in the hardcoded list of minor release titles!"
)

def index_item(path: pathlib.Path) -> dict:
return {"stem": path.stem, "path": str(path.relative_to(output_path))}
Expand Down
3 changes: 1 addition & 2 deletions tools/run_in_docker/rucio_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def sanitize(s: t.Optional[str]) -> str:
r">": r"\>",
}

for (before, after) in character_map.items():
for before, after in character_map.items():
s = s.replace(before, after)
return s

Expand Down Expand Up @@ -83,7 +83,6 @@ def generate_sections_markdown(sections):

@dataclasses.dataclass
class RucioProcessor(Processor):

_KEYWORDS = {
"Arguments": [
"arg",
Expand Down
1 change: 0 additions & 1 deletion tools/run_in_docker/rucio_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ def sanitize(s: str) -> str:

@dataclasses.dataclass
class RucioRenderer(Renderer):

markdown: MarkdownRenderer = dataclasses.field(default_factory=MarkdownRenderer)

def init(self, context: Context) -> None:
Expand Down

0 comments on commit 33e08d4

Please sign in to comment.