Skip to content

Commit

Permalink
bug: Protoc --version dropped major version.
Browse files Browse the repository at this point in the history
eg. 3.27.1 --> 27.1
  • Loading branch information
Max KvR committed Oct 1, 2024
1 parent 558c612 commit a4173c2
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 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 3 for g in ("major", "minor", "patch")) # type: ignore

_executable: str | None
_version: tuple[int, int, int] | None
Expand Down Expand Up @@ -113,10 +113,7 @@ def make_protobuf_requirement(major: int, minor: int, patch: int) -> str:

# This encodes on which minor protobuf version the major python protobuf
# version was bumped
protobuf_version_mapping = (
(3, 0),
(4, 21),
)
protobuf_version_mapping = ((3, 0), (4, 21), (5, 26))

# We must subtract one because bisect gives the insertion point after...
py_major = protobuf_version_mapping[
Expand Down

0 comments on commit a4173c2

Please sign in to comment.