File: version.py

package info (click to toggle)
libwpe 1.16.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 748 kB
  • sloc: ansic: 5,890; sh: 102; cpp: 57; python: 51; makefile: 5
file content (23 lines) | stat: -rw-r--r-- 654 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2021 Igalia S.L.
#
# Distributed under terms of the MIT license.

from os import environ, path
import re

version = {}
version_re = re.compile(r"^#define\s+WPE_([A-Z]+)_VERSION\s+(\d+)$")
version_file = path.join(environ["MESON_SOURCE_ROOT"], environ["MESON_SUBDIR"],
                         "include", "wpe", "libwpe-version.h")

with open(version_file, "r") as f:
    for line in f.readlines():
        m = version_re.match(line)
        if m:
            version[m.group(1)] = m.group(2)

print("{}.{}.{}".format(version["MAJOR"], version["MINOR"], version["MICRO"]))