INNER CODE UNIT · Python
read_version
CyrilPeng/Venera-Next · windows/build.py:33
def read_version():
content = (ROOT / "pubspec.yaml").read_text(encoding="utf-8")
match = re.search(r"^version:\s*([^\s]+)", content, re.MULTILINE)
if match is None:
raise RuntimeError("pubspec.yaml does not contain a version field")
return match.group(1).split("+", 1)[0]
def require_non_empty_file(path):
if not path.is_file():
raise FileNotFoundError(path)
if path.stat().st_size <= 0:
raise RuntimeError(f"{path} is empty")
def clean_windows_runner_build():
if WINDOWS_RUNNER_BUILD_DIR.exists():
shutil.rmtree(WINDOWS_RUNNER_BUILD_DIR)