INNER CODE UNIT · Python

parse_version_value

fluxerapp/flutter_client · .github/scripts/app_version.py:38

def parse_version_value(value: str) -> AppVersion:
    name, plus, build = value.strip().partition("+")
    parts = name.split(".")
    if len(parts) != 3:
        raise ValueError(f"Version is not year.month.public: {value}")
    year, month, public_release = (int(part) for part in parts)
    return AppVersion(
        year=year,
        month=month,
        public_release=public_release,
        build=f"+{build}" if plus == "+" else None,
    )


def read_pubspec_version(path: Path = PUBSPEC_PATH) -> AppVersion:
    for raw_line in path.read_text(encoding="utf-8").splitlines():
        match = VERSION_LINE_PATTERN.match(raw_line)
        if match is not None:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…