From 61dffba3955510ea369bdb3dc71e19281fc4543f Mon Sep 17 00:00:00 2001 From: Seth Michael Larson Date: Wed, 13 Sep 2023 23:01:41 -0500 Subject: [PATCH] Update how to find libbrotli version --- test/test_compatibility.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/test/test_compatibility.py b/test/test_compatibility.py index c5f5918..d37ec79 100644 --- a/test/test_compatibility.py +++ b/test/test_compatibility.py @@ -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"]) )