Skip to content

Commit

Permalink
bug: Protoc --version dropped major version.
Browse files Browse the repository at this point in the history
3.27.1 --> 27.1
  • Loading branch information
Max KvR committed Oct 1, 2024
1 parent d80ac2c commit 77e90dc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 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)) if version_search.group(g) is not None else 0 for g in ("major", "minor", "patch")) # type: ignore
return tuple(int(version_search.group(g)) if version_search.group(g) is not None else 3 for g in ("major", "minor", "patch")) # type: ignore

_executable: str | None
_version: tuple[int, int, int] | None
Expand Down Expand Up @@ -116,6 +116,7 @@ def make_protobuf_requirement(major: int, minor: int, patch: int) -> str:
protobuf_version_mapping = (
(3, 0),
(4, 21),
(5, 26)
)

# We must subtract one because bisect gives the insertion point after...
Expand Down

0 comments on commit 77e90dc

Please sign in to comment.