diff --git a/README.md b/README.md index 0444e479c..680ecda8e 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Build Status](https://travis-ci.org/webcomics/dosage.svg?branch=master)](https://travis-ci.org/webcomics/dosage) [![Code Climate](https://codeclimate.com/github/webcomics/dosage/badges/gpa.svg)](https://codeclimate.com/github/webcomics/dosage) [![codecov](https://codecov.io/gh/webcomics/dosage/branch/master/graph/badge.svg)](https://codecov.io/gh/webcomics/dosage) -[![Maintenance](https://img.shields.io/maintenance/yes/2018.svg)]() +[![Maintenance](https://img.shields.io/maintenance/yes/2019.svg)]() Dosage is designed to keep a local copy of specific webcomics and other picture-based content such as Picture of the Day sites. With the dosage @@ -67,11 +67,10 @@ For advanced options and features execute `dosage --help`. ## Dependencies [Python](http://www.python.org/): for Python 2.x at least 2.7.0, for Python 3.x -at least Python 3.3. Dosage requires the following Python modules: +at least Python 3.4. Dosage requires the following Python modules: - colorama - lxml -- pbr - requests - six diff --git a/dosagelib/__init__.py b/dosagelib/__init__.py index 0b3ee2948..6788241fa 100644 --- a/dosagelib/__init__.py +++ b/dosagelib/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam -# Copyright (C) 2015-2017 Tobias Gruetzmacher +# Copyright (C) 2015-2019 Tobias Gruetzmacher """ Automated comic downloader. Dosage traverses comic websites in order to download each strip of the comic. The intended use is for @@ -15,10 +15,12 @@ Comic modules for each comic are located in L{dosagelib.plugins}. """ from __future__ import absolute_import, division, print_function -from pbr.version import VersionInfo - AppName = u'dosage' -version_info = VersionInfo(AppName) -__version__ = version_info.version_string() # PEP 396 -AppVersion = version_info.release_string() +from pkg_resources import get_distribution, DistributionNotFound +try: + version_info = get_distribution(AppName) + __version__ = version_info.version # PEP 396 +except DistributionNotFound: + # package is not installed + pass diff --git a/dosagelib/cmd.py b/dosagelib/cmd.py index 9e25b65cf..557d9eb53 100644 --- a/dosagelib/cmd.py +++ b/dosagelib/cmd.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam -# Copyright (C) 2015-2018 Tobias Gruetzmacher +# Copyright (C) 2015-2019 Tobias Gruetzmacher from __future__ import absolute_import, division, print_function @@ -9,7 +9,8 @@ import os import argparse import six -from . import events, configuration, singleton, director, scraper, __version__ +from . import events, configuration, singleton, director, scraper +from . import AppName, __version__ from .output import out from .util import internal_error, strlimit @@ -126,7 +127,7 @@ def display_version(verbose): # display update link text = ('A new version %(version)s of %(app)s is ' 'available at %(url)s.') - attrs = dict(version=version, app=configuration.AppName, + attrs = dict(version=version, app=AppName, url=url, currentversion=__version__) print(text % attrs) else: @@ -134,7 +135,7 @@ def display_version(verbose): value = 'invalid update file syntax' text = ('An error occured while checking for an ' 'update of %(app)s: %(error)s.') - attrs = dict(error=value, app=configuration.AppName) + attrs = dict(error=value, app=AppName) print(text % attrs) return 0 diff --git a/dosagelib/configuration.py b/dosagelib/configuration.py index defaafe36..23bebcd23 100644 --- a/dosagelib/configuration.py +++ b/dosagelib/configuration.py @@ -1,25 +1,25 @@ # -*- coding: utf-8 -*- # Copyright (C) 2012-2014 Bastian Kleineidam -# Copyright (C) 2015-2017 Tobias Gruetzmacher +# Copyright (C) 2015-2019 Tobias Gruetzmacher """ Define basic configuration data like version or application name. """ from __future__ import absolute_import, division, print_function -from . import AppName, AppVersion +from . import AppName, __version__ -App = AppName + u' ' + AppVersion +App = AppName + u' ' + __version__ 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, AppVersion, +UserAgent = u"Mozilla/5.0 (compatible; %s/%s; +%s)" % (AppName, __version__, Url) Copyright = u"""Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs Copyright (C) 2012-2014 Bastian Kleineidam -Copyright (C) 2015-2017 Tobias Gruetzmacher +Copyright (C) 2015-2019 Tobias Gruetzmacher """ Freeware = AppName + u""" comes with ABSOLUTELY NO WARRANTY! This is free software, and you are welcome to redistribute it diff --git a/dosagelib/util.py b/dosagelib/util.py index f4f8a6f28..20bf21949 100644 --- a/dosagelib/util.py +++ b/dosagelib/util.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam -# Copyright (C) 2015-2018 Tobias Gruetzmacher +# Copyright (C) 2015-2019 Tobias Gruetzmacher from __future__ import absolute_import, division, print_function @@ -34,7 +34,8 @@ except ImportError: from backports.functools_lru_cache import lru_cache from .output import out -from .configuration import UserAgent, AppName, App, SupportUrl +from .configuration import UserAgent, App, SupportUrl +from . import AppName # Maximum content size for HTML pages MaxContentBytes = 1024 * 1024 * 3 # 3 MB diff --git a/requirements.txt b/requirements.txt index 4864f792b..2f36880e2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,5 @@ colorama lxml -pbr requests>=2.0 six backports.shutil_get_terminal_size; python_version<'3.3'