Fallback version if pkg_resources not available.

This helps for Windows packaging.
This commit is contained in:
Tobias Gruetzmacher 2016-03-03 01:05:36 +01:00
parent 8cf6282968
commit 017d35cb3c
2 changed files with 16 additions and 8 deletions

View file

@ -1,7 +1,7 @@
# -*- coding: iso-8859-1 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2004-2005 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2004-2005 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012-2014 Bastian Kleineidam # 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 Automated comic downloader. Dosage traverses comic websites in
order to download each strip of the comic. The intended use is for 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 from pbr.version import VersionInfo
import pkg_resources
AppName = u'dosage' AppName = u'dosage'
version_info = VersionInfo(AppName) 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"

View file

@ -1,22 +1,24 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2012-2014 Bastian Kleineidam # 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. Define basic configuration data like version or application name.
""" """
from __future__ import print_function 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' Maintainer = u'Tobias Gruetzmacher'
MaintainerEmail = u'tobias-dosage@23.gs' MaintainerEmail = u'tobias-dosage@23.gs'
Url = u'http://dosage.rocks/' Url = u'http://dosage.rocks/'
SupportUrl = u'https://github.com/webcomics/dosage/issues' 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 = u"""Copyright (C) 2004-2005 Tristan Seligmann and Jonathan Jacobs
Copyright (C) 2012-2014 Bastian Kleineidam 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! Freeware = AppName + u""" comes with ABSOLUTELY NO WARRANTY!
This is free software, and you are welcome to redistribute it This is free software, and you are welcome to redistribute it