Skip to content

Commit 43c22f3

Browse files
committed
Update how to find libbrotli version
1 parent 91eaa49 commit 43c22f3

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

test/test_compatibility.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,16 @@ def test_brotli_version():
2929
dirname(dirname(abspath(__file__))), "libbrotli/c/common/version.h"
3030
)
3131
with open(version_h) as f:
32-
brotli_version = int(
33-
re.search(
34-
r"#define BROTLI_VERSION 0x([A-Fa-f0-9]+)", f.read()
35-
).group(1),
36-
16,
32+
brotli_versions = dict(
33+
re.findall(
34+
r"#define BROTLI_VERSION_(MAJOR|MINOR|PATCH) ([0-9]+)",
35+
f.read()
36+
)
3737
)
38-
major = brotli_version >> 24
39-
minor = (brotli_version >> 12) & 0xFFF
40-
patch = brotli_version & 0xFFF
4138
assert brotlicffi.__version__.startswith(
42-
"%d.%d.%d." % (major, minor, patch)
39+
"%s.%s.%s." % (
40+
brotli_versions["MAJOR"],
41+
brotli_versions["MINOR"],
42+
brotli_versions["PATCH"]
43+
)
4344
)

0 commit comments

Comments
 (0)