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 b75176f commit 61dffba
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions test/test_compatibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,7 @@ 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,
)
major = brotli_version >> 24
minor = (brotli_version >> 12) & 0xFFF
patch = brotli_version & 0xFFF
brotli_versions = dict(re.findall(r"#define BROTLI_VERSION_(MAJOR|MINOR|PATCH) ([0-9]+)", f.read()))
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 61dffba

Please sign in to comment.