diff options
author | Eugene Kliuchnikov <eustas@google.com> | 2016-08-22 15:44:12 +0200 |
---|---|---|
committer | Eugene Kliuchnikov <eustas@google.com> | 2016-08-22 15:44:12 +0200 |
commit | 2c2d5578a6a65819deeeea64aeaf3e911038a9f5 (patch) | |
tree | c214b8dd8d9c437f0ab4d7384ff55ce0108feb04 /setup.py | |
parent | 313066a0370ff1e713e9891d88fb28ab834d5031 (diff) | |
download | brotli-2c2d5578a6a65819deeeea64aeaf3e911038a9f5.zip brotli-2c2d5578a6a65819deeeea64aeaf3e911038a9f5.tar.gz brotli-2c2d5578a6a65819deeeea64aeaf3e911038a9f5.tar.bz2 |
Use version from common/version.h
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -15,14 +15,17 @@ CURR_DIR = os.path.abspath(os.path.dirname(os.path.realpath(__file__))) def get_version(): - """ Return BROTLI_VERSION string as defined in 'tools/version.h' file. """ - brotlimodule = os.path.join(CURR_DIR, 'tools', 'version.h') + """ Return BROTLI_VERSION string as defined in 'common/version.h' file. """ + brotlimodule = os.path.join(CURR_DIR, 'common', 'version.h') + version = 0 with open(brotlimodule, 'r') as f: for line in f: - m = re.match(r'#define\sBROTLI_VERSION\s"(.*)"', line) + m = re.match(r'#define\sBROTLI_VERSION\s+0x([0-9a-fA-F])', line) if m: - return m.group(1) - return "" + version = int(m.group(1), 16) + if version == 0: + return "" + return "{0}.{1}.{2}".format(version >> 24, (version >> 12) & 0xFFF, version & 0xFFF) class TestCommand(Command): @@ -146,6 +149,7 @@ brotli = Extension("brotli", "common/constants.h", "common/dictionary.h", "common/port.h", + "common/version.h", "dec/bit_reader.h", "dec/context.h", "dec/huffman.h", |