| 160 | sp.check_call(cmdline) |
| 161 | |
| 162 | def _parse_version_from_file(self, fp: Path) -> Version: |
| 163 | logger.debug("looking for version in %s", fp) |
| 164 | matches = [] |
| 165 | with fp.open() as f: |
| 166 | for line in f: |
| 167 | if m := self._ini_regex.match(line): |
| 168 | matches.append(m) |
| 169 | |
| 170 | if not matches: |
| 171 | raise ValueError(f"no version found in {fp}") |
| 172 | elif len(matches) > 1: |
| 173 | raise ValueError(f"more than one version found in {fp}") |
| 174 | |
| 175 | vs = Version(matches[0].group("ver")) |
| 176 | return vs |
| 177 | |
| 178 | def _update_version_in_file(self, fp: Path, version: Version) -> None: |
| 179 | logger.info("upgrading version in %s", fp) |