Commit 4450b7e8 authored by Michal Čihař's avatar Michal Čihař

Change version handling

We set -dev version in the sources, what makes handling consistent
regardless whether user runs git or not.

Fixes #921
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 39a86066
......@@ -6,7 +6,7 @@ if [ -z "$1" ] ; then
exit 1
fi
sed -i "s/^VERSION =.*/VERSION = '$1'/" weblate/__init__.py
sed -i "s/^VERSION =.*/VERSION = '$1-dev'/" weblate/__init__.py
sed -i "s/version =.*/version = '$1'/" docs/conf.py
sed -i "s/Version: .*/Version: $1/" weblate.spec
sed -i "s/version=.*,/version='$1',/" setup.py
......
......@@ -38,44 +38,28 @@ def get_root_dir():
return os.path.abspath(os.path.join(curdir, '..'))
def is_running_git():
'''
Checks whether we're running inside Git checkout.
'''
return os.path.exists(os.path.join(get_root_dir(), '.git', 'config'))
# Weblate version
VERSION = '2.5'
VERSION = '2.5-dev'
# Version string without suffix
VERSION_BASE = VERSION
VERSION_BASE = VERSION.replace('-dev', '')
# User-Agent string to use
USER_AGENT = 'Weblate/{0}'.format(VERSION)
# Are we running git
RUNNING_GIT = is_running_git()
GIT_RELEASE = False
GIT_VERSION = VERSION
# Grab some information from git
if RUNNING_GIT:
try:
# Describe current checkout
GIT_VERSION = GitRepository(get_root_dir()).describe()
# Check if we're close to release tag
parts = GIT_VERSION.split('-')
GIT_RELEASE = (len(parts) <= 2 or int(parts[2]) < 20)
del parts
try:
# Describe current checkout
GIT_VERSION = GitRepository(get_root_dir()).describe()
# Mark version as devel if it is
if not GIT_RELEASE:
VERSION += '-dev'
except (RepositoryException, OSError):
# Import failed or git has troubles reading
# repo (eg. swallow clone)
RUNNING_GIT = False
# Check if we're close to release tag
parts = GIT_VERSION.split('-')
GIT_RELEASE = (len(parts) <= 2 or int(parts[2]) < 20)
del parts
except (RepositoryException, OSError):
# Import failed or git has troubles reading
# repo (eg. swallow clone)
GIT_VERSION = VERSION
def get_doc_url(page, anchor=''):
......@@ -83,7 +67,7 @@ def get_doc_url(page, anchor=''):
Return URL to documentation.
'''
# Should we use tagged release or latest version
if RUNNING_GIT and not GIT_RELEASE:
if '-dev' in VERSION:
version = 'latest'
else:
version = 'weblate-%s' % VERSION
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment