INNER CODE UNIT · Python

calendar_version_for

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

def calendar_version_for(now: datetime, current: AppVersion) -> AppVersion:
    if (current.year, current.month) >= (now.year, now.month):
        return current
    return AppVersion(
        year=now.year,
        month=now.month,
        public_release=DEFAULT_PUBLIC_RELEASE,
        build=current.build,
    )


def _pubspec_version_value(path: Path) -> str:
    for raw_line in path.read_text(encoding="utf-8").splitlines():
        match = VERSION_LINE_PATTERN.match(raw_line)
        if match is not None:
            build = match.group(5) or ""
            return f"{match.group(2)}.{match.group(3)}.{match.group(4)}{build}"
    raise ValueError(f"Could not find version in {path}")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…