From 017d35cb3c5655b5b2defe9ad8f2e4da01172696 Mon Sep 17 00:00:00 2001 From: Tobias Gruetzmacher Date: Thu, 3 Mar 2016 01:05:36 +0100 Subject: [PATCH] Fallback version if pkg_resources not available. This helps for Windows packaging. --- dosagelib/__init__.py | 12 +++++++++--- dosagelib/configuration.py | 12 +++++++----- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/dosagelib/__init__.py b/dosagelib/__init__.py index 24dd38b31..f0466b926 100644 --- a/dosagelib/__init__.py +++ b/dosagelib/__init__.py @@ -1,7 +1,7 @@ -# -*- coding: iso-8859-1 -*- +# -*- coding: utf-8 -*- # Copyright (C) 2004-2005 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam -# Copyright (C) 2015 Tobias Gruetzmacher +# Copyright (C) 2015-2016 Tobias Gruetzmacher """ Automated comic downloader. Dosage traverses comic websites in order to download each strip of the comic. The intended use is for @@ -15,7 +15,13 @@ Comic modules for each comic are located in L{dosagelib.plugins}. """ from pbr.version import VersionInfo +import pkg_resources AppName = u'dosage' version_info = VersionInfo(AppName) -__version__ = version_info.version_string() # PEP 396 +try: + __version__ = version_info.version_string() # PEP 396 + AppVersion = version_info.version_string_with_vcs() +except pkg_resources.DistributionNotFound: + __version__ = "2.15.0" + AppVersion = __version__ + "-unknown" diff --git a/dosagelib/configuration.py b/dosagelib/configuration.py index 042ffcf95..a516f02fc 100644 --- a/dosagelib/configuration.py +++ b/dosagelib/configuration.py @@ -1,22 +1,24 @@ +# -*- coding: utf-8 -*- # Copyright (C) 2012-2014 Bastian Kleineidam -# Copyright (C) 2015 Tobias Gruetzmacher +# Copyright (C) 2015-2016 Tobias Gruetzmacher """ Define basic configuration data like version or application name. """ from __future__ import print_function -from . import __version__, AppName +from . import AppName, AppVersion -App = AppName + u' ' + __version__ +App = AppName + u' ' + AppVersion Maintainer = u'Tobias Gruetzmacher' MaintainerEmail = u'tobias-dosage@23.gs' Url = u'http://dosage.rocks/' SupportUrl = u'https://github.com/webcomics/dosage/issues' -UserAgent = u"Mozilla/5.0 (compatible; %s/%s; +%s)" % (AppName, __version__, Url) +UserAgent = u"Mozilla/5.0 (compatible; %s/%s; +%s)" % (AppName, AppVersion, + Url) Copyright = u"""Copyright (C) 2004-2005 Tristan Seligmann and Jonathan Jacobs Copyright (C) 2012-2014 Bastian Kleineidam -Copyright (C) 2015 Tobias Gruetzmacher +Copyright (C) 2015-2016 Tobias Gruetzmacher """ Freeware = AppName + u""" comes with ABSOLUTELY NO WARRANTY! This is free software, and you are welcome to redistribute it