You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
572 B
Python
25 lines
572 B
Python
#!/usr/bin/env python3
|
|
|
|
"""Print current tinc version for using in build scripts."""
|
|
|
|
from os import path, environ
|
|
import subprocess as subp
|
|
|
|
PREFIX = "release-"
|
|
SOURCE_ROOT = path.dirname(path.realpath(__file__))
|
|
SOURCE_ROOT = environ.get("MESON_SOURCE_ROOT", SOURCE_ROOT)
|
|
|
|
cmd = [
|
|
"git",
|
|
"--git-dir",
|
|
path.join(SOURCE_ROOT, ".git"),
|
|
"describe",
|
|
"--always",
|
|
"--tags",
|
|
"--match=" + PREFIX + "*",
|
|
]
|
|
|
|
result = subp.run(cmd, stdout=subp.PIPE, encoding="utf-8", check=True)
|
|
version = result.stdout.strip().replace("release-", "", 1)
|
|
print(version)
|