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.
This commit is contained in:
parent
65a86bdd7c
commit
92425abcab
@ -3,10 +3,13 @@ NAME = 'openSUSE-release-tools'
|
|||||||
|
|
||||||
def version_calculate():
|
def version_calculate():
|
||||||
from os import path
|
from os import path
|
||||||
if path.exists('.git'):
|
# 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
|
from osclib.git import describe
|
||||||
try:
|
try:
|
||||||
return describe()
|
return describe(directory=osc_release_tools_dir)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
pass # Fall through to final return.
|
pass # Fall through to final return.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user