summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Doan <andy.doan@linaro.org>2014-08-06 10:45:00 -0500
committerAndy Doan <andy.doan@linaro.org>2014-08-06 10:46:15 -0500
commitbf6135cfdada1f341c18d1057dff178c09bb07b6 (patch)
tree3b3755b30ef1049e066cbd2eba4d44a154290bdd
parenta76d5d2df41e574f45263fda9d947abb53b830af (diff)
Fix issue with version logic2014.07.1
Basically a dup of: https://bugs.linaro.org/show_bug.cgi?id=322 Change-Id: I025c36e301edfb0b3d8aa328180751d94dc1d7bb
-rw-r--r--apps/version.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/apps/version.py b/apps/version.py
index e8aca2b..78e32e7 100644
--- a/apps/version.py
+++ b/apps/version.py
@@ -1,3 +1,4 @@
+import os
import re
import subprocess
@@ -6,9 +7,13 @@ VERSION = None
def _get_version():
'''return either the tag on HEAD or the shortened commit id if not found'''
- out = subprocess.check_output(['git', 'log', '--format=%h %d', '-1'])
+ out = subprocess.check_output(['git', 'log', '--format=%h %d', '-1'],
+ cwd=os.path.dirname(__file__))
version, ref_names = out.split('(')
m = re.match(r'.*tag: (\d{4}\.\d{2}.*?),', ref_names)
+ if not m:
+ # might be an older version of git
+ m = re.match(r'.*HEAD, (\d{4}\.\d{2}.*?),', ref_names)
if m:
version = m.group(1)
return version.strip()