1 # Copyright (C) 2013 W. Trevor King <wking@tremily.us>
3 # This file is part of rss2email.
5 # rss2email is free software: you can redistribute it and/or modify it under
6 # the terms of the GNU General Public License as published by the Free Software
7 # Foundation, either version 2 of the License, or (at your option) version 3 of
10 # rss2email is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License along with
15 # rss2email. If not, see <http://www.gnu.org/licenses/>.
17 """Calculate version numbers for this package and its dependencies
19 This makes it easier for users to submit useful bug reports.
22 import importlib as _importlib
25 from . import __version__
28 def get_rss2email_version(package):
31 def get_python_version(package):
34 def get_python_package_version(package):
36 module = _importlib.import_module(package)
37 except ImportError as e:
39 return getattr(module, '__version__', 'unknown')
41 def get_versions(packages=None):
43 packages = ['rss2email', 'python', 'feedparser', 'html2text']
44 for package in packages:
46 'get_{}_version'.format(package),
47 get_python_package_version)
48 version = get(package=package)
49 yield (package, version)