Dan Čermák 92425abcab
version_calculate: chdir to the osclib dir
version_calculate() calls describe in the current working dir, but that fails in
git repositories without any commits in them. Actually we should be calling this
in the osc-release-tools repository instead, hence fixing this issue.
2023-08-15 11:45:42 +02:00

20 lines
611 B
Python

NAME = 'openSUSE-release-tools'
def version_calculate():
from os import path
# osclib is most likely "installed" via a symlink in ~/.osc-plugins
# => need to resolve the relative path
osc_release_tools_dir = path.abspath(path.join(path.realpath(path.dirname(__file__)), ".."))
if path.exists(path.join(osc_release_tools_dir, ".git")):
from osclib.git import describe
try:
return describe(directory=osc_release_tools_dir)
except FileNotFoundError:
pass # Fall through to final return.
return '0.0.0-dev'
VERSION = version_calculate()