INNER CODE UNIT · Python
_pubspec_version_value
fluxerapp/flutter_client · .github/scripts/app_version.py:93
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}")
def roll_pubspec_calendar(now: datetime | None = None, path: Path = PUBSPEC_PATH) -> tuple[bool, AppVersion]:
if now is None:
now = datetime.now(timezone.utc)
current = read_pubspec_version(path)
next_version = calendar_version_for(now, current)
if _pubspec_version_value(path) == next_version.pubspec_value:
return False, next_version
write_pubspec_version(next_version, path)
return True, next_version