update bump_version.py

This commit is contained in:
Stepland 2024-01-07 03:59:54 +01:00
parent a1997abcf4
commit c3bcc13b70

View File

@ -15,7 +15,7 @@ class Version:
return f"{self.major}.{self.minor}.{self.patch}{self.extra}"
def parse_version(text: str) -> Version:
if (match := re.fullmatch("(\d+)\.(\d+).(\d+)(.*)", text)):
if (match := re.fullmatch(r"(\d+)\.(\d+).(\d+)(.*)", text)):
return Version(
major=int(match.group(1)),
minor=int(match.group(2)),
@ -26,7 +26,7 @@ def parse_version(text: str) -> Version:
raise ValueError(f"Couldn't parse {text} as a version number")
def rewrite_debian_control_file():
path = Path(__file__).parents[1] / "debian_packaging/f.e.i.s-control"
path = Path(__file__).parents[1] / "packaging/debian/f.e.i.s-control"
with path.open(mode="r+") as f:
debian_control_lines = f.readlines()
for i in range(len(debian_control_lines)):
@ -47,6 +47,6 @@ args = parser.parse_args()
rewrite_debian_control_file()
subprocess.check_call(["meson", "rewrite", "kwargs", "set", "project", "/", "version", str(args.version)])
if not args.dry_run:
subprocess.check_call(["git", "add", "meson.build", "debian_packaging/f.e.i.s-control"])
subprocess.check_call(["git", "add", "meson.build", "packaging/debian/f.e.i.s-control"])
subprocess.check_call(["git", "commit", "-m", f"bump to v{args.version}"])
subprocess.check_call(["git", "tag", f"v{args.version}"])