(v: str, part: str)
| 42 | |
| 43 | |
| 44 | def bump_part(v: str, part: str) -> str: |
| 45 | m = SEMVER_RE.match(v) |
| 46 | if not m: |
| 47 | raise ValueError(f"Not a semver: {v}") |
| 48 | major, minor, patch = map(int, m.groups()) |
| 49 | if part == "major": |
| 50 | return f"{major+1}.0.0" |
| 51 | if part == "minor": |
| 52 | return f"{major}.{minor+1}.0" |
| 53 | if part == "patch": |
| 54 | return f"{major}.{minor}.{patch+1}" |
| 55 | raise ValueError(part) |
| 56 | |
| 57 | |
| 58 | def replace_version_in_project_section(toml: str, new_version: str) -> tuple[str, bool]: |