Skip to content

Commit

Permalink
automatic determination of version string
Browse files Browse the repository at this point in the history
  • Loading branch information
GeraldJansen committed Nov 20, 2019
1 parent f35eab3 commit 8e717d2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
10 changes: 6 additions & 4 deletions src/hamster-lite
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,6 @@ class HamsterClient(object):
def overview(self, *args):
self._launch_window("overview")

def statistics(self, *args):
self._launch_window("statistics")

def about(self, *args):
self._launch_window("about")

Expand Down Expand Up @@ -272,6 +269,10 @@ class HamsterClient(object):

print()

def version(self):
from hamster.lib.configuration import runtime
print(runtime.version)


if __name__ == '__main__':
from hamster_lite.lib import i18n
Expand All @@ -291,8 +292,9 @@ Actions:
* activities: List all the activities names, one per line.
* categories: List all the categories names, one per line.
* overview / statistics / about: launch specific window
* overview / add / prefs / about: launch specific window
* version: Show the hamster-lite version
Time formats:
* 'YYYY-MM-DD hh:mm': If start-date is missing, it will default to today.
If end-date is missing, it will default to start-date.
Expand Down
4 changes: 3 additions & 1 deletion src/hamster_lite/lib/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ def __init__(self):
# if defs is not there, we are running from sources
module_dir = os.path.dirname(os.path.realpath(__file__))
self.data_dir = os.path.join(module_dir, '..', '..', '..', 'data')
self.version = "uninstalled"
from subprocess import getstatusoutput
rc, output = getstatusoutput("git describe --tags --always --dirty=+")
self.version = "" if rc else output + " (uninstalled)"

self.data_dir = os.path.realpath(self.data_dir)
self.storage = db.Storage()
Expand Down
4 changes: 3 additions & 1 deletion wscript
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# -*- python -*-
VERSION = '0.1'
from subprocess import getstatusoutput
rc, output = getstatusoutput("git describe --tags --always --dirty=+")
VERSION = '0.1.0' if rc else output
APPNAME = 'hamster-lite'
top = '.'
out = 'build'
Expand Down

0 comments on commit 8e717d2

Please sign in to comment.