Mercurial > kallithea
changeset 6201:d55ff973d01f
lib: simplify version; drop get_current_revision - it was run every time on import time - we don't want that
This functionality was already not in use with the version numbers we use. I
also doubt it is possible to have version numbers where it worked - it seems
like there might have been some regression that nobody noticed. Dropping it
will thus not really lose any actual functionality.
If we want to include the revision number in the version (for browser cache
invalidation) then we should do it in a different way. Perhaps writing it to
some file from setup.py .
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Mon, 12 Sep 2016 17:41:19 +0200 |
parents | c6232b791d87 |
children | 940a48e28a03 |
files | kallithea/__init__.py kallithea/lib/__init__.py |
diffstat | 2 files changed, 1 insertions(+), 43 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/__init__.py Mon Sep 12 17:41:19 2016 +0200 +++ b/kallithea/__init__.py Mon Sep 12 17:41:19 2016 +0200 @@ -54,15 +54,7 @@ # Users.extern_type and .extern_name value for local users EXTERN_TYPE_INTERNAL = 'internal' -try: - from kallithea.lib import get_current_revision - _rev = get_current_revision(quiet=True) - if _rev and len(VERSION) > 3: - VERSION += (_rev[0],) -except ImportError: - pass - -__version__ = ('.'.join((str(each) for each in VERSION[:3]))) +__version__ = '.'.join(str(each) for each in VERSION) __dbversion__ = 31 # defines current db version for migrations __platform__ = platform.system() __license__ = 'GPLv3' @@ -73,13 +65,6 @@ is_windows = __platform__ in ['Windows'] is_unix = not is_windows -if len(VERSION) > 3: - __version__ += '.'+VERSION[3] - - if len(VERSION) > 4: - __version__ += VERSION[4] - else: - __version__ += '0' # Hack for making the celery dependency kombu==1.5.1 compatible with Python # 2.7.11 which has https://hg.python.org/releases/2.7.11/rev/24bdc4940e81
--- a/kallithea/lib/__init__.py Mon Sep 12 17:41:19 2016 +0200 +++ b/kallithea/lib/__init__.py Mon Sep 12 17:41:19 2016 +0200 @@ -24,30 +24,3 @@ :copyright: (c) 2013 RhodeCode GmbH, and others. :license: GPLv3, see LICENSE.md for more details. """ - -import os - -def get_current_revision(quiet=False): - """ - Returns tuple of (number, id) from repository containing this package - or None if repository could not be found. - - :param quiet: prints error for fetching revision if True - """ - - try: - from kallithea.lib.vcs import get_repo - from kallithea.lib.vcs.utils.helpers import get_scm - repopath = os.path.abspath(os.path.join(os.path.dirname(__file__), - '..', '..')) - scm = get_scm(repopath)[0] - repo = get_repo(path=repopath, alias=scm) - wk_dir = repo.workdir - cur_rev = wk_dir.get_changeset() - return (cur_rev.revision, cur_rev.short_id) - except Exception as err: - if not quiet: - print ("WARNING: Cannot retrieve kallithea's revision. " - "disregard this if you don't know what that means. " - "Original error was: %s" % err) - return None