Add parametrized release script

[ci skip]
This commit is contained in:
Anonymous Maarten 2024-10-04 01:40:42 +02:00
parent 2c60d95ee2
commit e4126d8d6f
7 changed files with 798 additions and 339 deletions

View file

@ -2,6 +2,7 @@
import argparse
from pathlib import Path
import json
import logging
import re
import subprocess
@ -10,9 +11,9 @@ ROOT = Path(__file__).resolve().parents[1]
def determine_project() -> str:
text = (ROOT / "CMakeLists.txt").read_text()
match = next(re.finditer(r"project\((?P<project>[a-zA-Z0-9_]+)\s+", text, flags=re.M))
project_with_version = match["project"]
text = (ROOT / "build-scripts/release-info.json").read_text()
release_info = json.loads(text)
project_with_version = release_info["name"]
project, _ = re.subn("([^a-zA-Z_])", "", project_with_version)
return project