From 7ba58d0b63a3525c48e5c11f3994d15b5a8184fb Mon Sep 17 00:00:00 2001 From: j Date: Fri, 15 May 2020 18:48:58 +0200 Subject: [PATCH] add way to change version --- pandora/app/config.py | 12 ++++-------- pandora/settings.py | 2 ++ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/pandora/app/config.py b/pandora/app/config.py index 36dfdfe3..7d158e4d 100644 --- a/pandora/app/config.py +++ b/pandora/app/config.py @@ -29,18 +29,14 @@ RUN_RELOADER = True NOTIFIER = None def get_version(): - info = join(dirname(dirname(dirname(__file__))), '.bzr', 'branch', 'last-revision') git_dir = join(dirname(dirname(dirname(__file__))), '.git') if exists(git_dir): env = {'GIT_DIR': git_dir} cmd = ['git', 'rev-list', 'HEAD', '--count'] - return subprocess.check_output(cmd, env=env).strip().decode('utf-8') - elif exists(info): - f = open(info) - rev = int(f.read().split()[0]) - f.close() - if rev: - return u'%s' % rev + version = subprocess.check_output(cmd, env=env).strip().decode('utf-8') + if settings.VERSION_EPOCH: + version = settings.VERSION_EPOCH + version + return version else: return u'unknown' diff --git a/pandora/settings.py b/pandora/settings.py index 83dfb602..fd1cf7a0 100644 --- a/pandora/settings.py +++ b/pandora/settings.py @@ -36,6 +36,8 @@ LANGUAGE_CODE = 'en-us' SITE_ID = 1 +VERSION_EPOCH = None + # If you set this to False, Django will make some optimizations so as not # to load the internationalization machinery. USE_I18N = True