MCPcopy Create free account
hub / github.com/pytest-dev/pytest / parse_changelog

Function parse_changelog

scripts/publish-gh-release-notes.py:38–57  ·  view source on GitHub ↗
(tag_name)

Source from the content-addressed store, hash-verified

36
37
38def parse_changelog(tag_name):
39 p = Path(__file__).parent.parent / "doc/en/changelog.rst"
40 changelog_lines = p.read_text(encoding="UTF-8").splitlines()
41
42 title_regex = re.compile(r"pytest (\d\.\d+\.\d+) \(\d{4}-\d{2}-\d{2}\)")
43 consuming_version = False
44 version_lines = []
45 for line in changelog_lines:
46 m = title_regex.match(line)
47 if m:
48 # found the version we want: start to consume lines until we find the next version title
49 if m.group(1) == tag_name:
50 consuming_version = True
51 # found a new version title while parsing the version we want: break out
52 elif consuming_version:
53 break
54 if consuming_version:
55 version_lines.append(line)
56
57 return "\n".join(version_lines)
58
59
60def convert_rst_to_md(text):

Callers 1

mainFunction · 0.85

Calls 3

compileMethod · 0.80
matchMethod · 0.80
appendMethod · 0.80

Tested by

no test coverage detected