Skip to content

Commit

Permalink
Update how to find libbrotli version
Browse files Browse the repository at this point in the history
  • Loading branch information
sethmlarson committed Sep 14, 2023
1 parent 91eaa49 commit 43c22f3
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions test/test_compatibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,16 @@ def test_brotli_version():
dirname(dirname(abspath(__file__))), "libbrotli/c/common/version.h"
)
with open(version_h) as f:
brotli_version = int(
re.search(
r"#define BROTLI_VERSION 0x([A-Fa-f0-9]+)", f.read()
).group(1),
16,
brotli_versions = dict(
re.findall(
r"#define BROTLI_VERSION_(MAJOR|MINOR|PATCH) ([0-9]+)",
f.read()
)
)
major = brotli_version >> 24
minor = (brotli_version >> 12) & 0xFFF
patch = brotli_version & 0xFFF
assert brotlicffi.__version__.startswith(
"%d.%d.%d." % (major, minor, patch)
"%s.%s.%s." % (
brotli_versions["MAJOR"],
brotli_versions["MINOR"],
brotli_versions["PATCH"]
)
)

0 comments on commit 43c22f3

Please sign in to comment.