File: wutils.py

package info (click to toggle)
pybindgen 0.20.0%2Bdfsg1-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,932 kB
  • sloc: python: 15,981; cpp: 1,889; ansic: 617; makefile: 86; sh: 4
file content (19 lines) | stat: -rw-r--r-- 563 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import os.path
import sys
import subprocess
import re


def get_version(path=None):
    filename = os.path.join(os.path.dirname(__file__), 'pybindgen', 'version.py')
    if os.path.exists(filename):
        # Read the version.py from the version file
        with open(filename, "rt") as versionpy:
            for line in versionpy:
                try:
                    head, rest = line.split("version = ")
                except ValueError:
                    continue
                return eval(rest)
            return version_str
    return 'unknown'