diff --git a/osmtm/__init__.py b/osmtm/__init__.py index fb08f547..5c9ffdae 100644 --- a/osmtm/__init__.py +++ b/osmtm/__init__.py @@ -1,4 +1,6 @@ import bleach +import subprocess +import os from pyramid.config import Configurator from pyramid.authentication import AuthTktAuthenticationPolicy from pyramid.authorization import ACLAuthorizationPolicy @@ -27,11 +29,19 @@ scheduler.start() +try: + version = subprocess.check_output(['git', 'describe', '--always'], + cwd=os.path.dirname(__file__)) +except Exception as e: + version = 'N/A' + + def main(global_config, **settings): """ This function returns a Pyramid WSGI application. """ settings['mako.directories'] = 'osmtm:templates' load_local_settings(settings) + settings.update({'version': version}) engine = engine_from_config(settings, 'sqlalchemy.') DBSession.configure(bind=engine) diff --git a/osmtm/templates/about.mako b/osmtm/templates/about.mako index 62272d2d..61841737 100644 --- a/osmtm/templates/about.mako +++ b/osmtm/templates/about.mako @@ -61,18 +61,10 @@ ${_('Lead developer: Pierre GIRAUD (Camptocamp)')|n} ${_('with the help of other contributors.') |n}

-<% - from gitversion import determine_git_version - - try: - ver = determine_git_version('.') - url = 'https://github.com/hotosm/osm-tasking-manager2/commit/' + ver.rsplit('.',1)[1] - txt = '%s' % (url, ver) - vertxt = '

' + _('Version') + '

' + txt + '

' - except: - vertxt = '' -%> - ${vertxt |n} +

${_('Version')}

+

+ ${request.registry.settings['version']} +

diff --git a/setup.py b/setup.py index 1ca5182b..18fedf12 100644 --- a/setup.py +++ b/setup.py @@ -35,7 +35,6 @@ 'pyramid-exclog==0.7', 'httpretty', 'pygments', - 'gitversion', 'APScheduler==3.0.3', 'python-oembed == 0.2.1', 'colour==0.1.2',