Parse the CHANGES.txt file.
(self)
| 457 | self.versions: List[VersionSection] = [] |
| 458 | |
| 459 | def parse(self): |
| 460 | """Parse the CHANGES.txt file.""" |
| 461 | with open(self.changes_file_path, 'r', encoding='utf-8') as f: |
| 462 | content = f.read() |
| 463 | |
| 464 | # Split into version sections |
| 465 | version_matches = list(self.VERSION_HEADER_PATTERN.finditer(content)) |
| 466 | |
| 467 | for i, version_match in enumerate(version_matches): |
| 468 | version = version_match.group(1) |
| 469 | start_pos = version_match.end() |
| 470 | |
| 471 | # Find the end of this version section (start of next version or EOF) |
| 472 | if i + 1 < len(version_matches): |
| 473 | end_pos = version_matches[i + 1].start() |
| 474 | else: |
| 475 | end_pos = len(content) |
| 476 | |
| 477 | version_content = content[start_pos:end_pos] |
| 478 | version_section = self._parse_version_section(version, version_content) |
| 479 | self.versions.append(version_section) |
| 480 | |
| 481 | def _parse_version_section(self, version: str, content: str) -> VersionSection: |
| 482 | """Parse all entries within a single version section.""" |
no test coverage detected