diff options
Diffstat (limited to 'tools/git.defs')
-rw-r--r-- | tools/git.defs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/git.defs b/tools/git.defs new file mode 100644 index 0000000000..557dff2319 --- /dev/null +++ b/tools/git.defs @@ -0,0 +1,9 @@ +def git_version(): + import subprocess + cmd = ['git', 'describe', '--always', '--match', 'v[0-9].*', '--dirty'] + p = subprocess.Popen(cmd, stdout = subprocess.PIPE) + v = p.communicate()[0].strip() + r = p.returncode + if r != 0: + raise subprocess.CalledProcessError(r, ' '.join(cmd)) + return v |