summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--b4/command.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/b4/command.py b/b4/command.py
index f36f3ea..d465732 100644
--- a/b4/command.py
+++ b/b4/command.py
@@ -158,4 +158,16 @@ def cmd():
if __name__ == '__main__':
+ # We're running from a checkout, so reflect git commit in the version
+ import os
+ # noinspection PyBroadException
+ try:
+ base = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
+ dotgit = os.path.join(base, '.git')
+ ecode, short = b4.git_run_command(dotgit, ['rev-parse', '--short', 'HEAD'])
+ if ecode == 0:
+ b4.__VERSION__ = '%s-%s' % (b4.__VERSION__, short.strip())
+ except Exception as ex:
+ # Any failures above are non-fatal
+ pass
cmd()