Skip to content

Commit

Permalink
Fixed Regex, that breakes setup if no minor version is supplied
Browse files Browse the repository at this point in the history
  • Loading branch information
Max KvR committed Sep 2, 2024
1 parent 6a17919 commit d80ac2c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ def _find_protoc() -> str | None:
def _get_protoc_version(protoc: str) -> tuple[int, int, int]:
protoc_version_string = str(subprocess.check_output([protoc, "--version"]))
version_search = re.search(
r"((?P<major>(0|[1-9]\d*))\.(?P<minor>(0|[1-9]\d*))\.(?P<patch>(0|[1-9]\d*)))",
r"((?P<major>(0|[1-9]\d*))\.(?P<minor>(0|[1-9]\d*))(\.(?P<patch>(0|[1-9]\d*)))?)",
protoc_version_string,
)

return tuple(int(version_search.group(g)) for g in ("major", "minor", "patch")) # type: ignore
return tuple(int(version_search.group(g)) if version_search.group(g) is not None else 0 for g in ("major", "minor", "patch")) # type: ignore

_executable: str | None
_version: tuple[int, int, int] | None
Expand Down

0 comments on commit d80ac2c

Please sign in to comment.