From d9ccb02969cb4239ee2704c47c70b9d810159949 Mon Sep 17 00:00:00 2001 From: Emanuel Schuetze Date: Wed, 31 Oct 2012 07:11:53 +0100 Subject: [PATCH] Changed version number string. Important for building portable version. Used alpha|beta|rc without git commit hash. Added 'dev' suffix which use git hash only. It is easier to handle in file names of releases. --- openslides/__init__.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/openslides/__init__.py b/openslides/__init__.py index 0fd7c9fdd..fe637ceab 100644 --- a/openslides/__init__.py +++ b/openslides/__init__.py @@ -16,7 +16,7 @@ def get_version(version=None): if version is None: version = VERSION assert len(version) == 5 - assert version[3] in ('alpha', 'beta', 'rc', 'final') + assert version[3] in ('dev', 'alpha', 'beta', 'rc', 'final') # Now build the two parts of the version number: # main = X.Y[.Z] @@ -27,16 +27,17 @@ def get_version(version=None): main = '.'.join(str(x) for x in version[:main_parts]) if version[3] != 'final': - mapping = {'alpha': 'a', 'beta': 'b', 'rc': 'c'} - sub = mapping[version[3]] + str(version[4]) - try: - git_head_path = '.git/' + open('.git/HEAD', 'r').read()[5:].rstrip() - except IOError: - git_commit_id = 'unknown' + if version[3] == 'dev': + try: + git_head_path = '.git/' + open('.git/HEAD', 'r').read()[5:].rstrip() + except IOError: + git_commit_id = 'unknown' + else: + import os + git_commit_id = open(os.path.abspath(git_head_path), 'r').read().rstrip() + sub = '-%s%s' % (version[3], git_commit_id) else: - import os - git_commit_id = open(os.path.abspath(git_head_path), 'r').read().rstrip() - sub = '%s commit %s' % (sub, git_commit_id) + sub = '-' + version[3] + str(version[4]) else: sub = ''