Add a short=True argument to version.version().

Fixes #787.
This commit is contained in:
Florian Bruhin 2015-06-26 22:33:29 +02:00
parent 956baed76b
commit e9b5c355d2
2 changed files with 25 additions and 17 deletions

View File

@ -61,7 +61,7 @@ def run(args):
"""Initialize everthing and run the application."""
# pylint: disable=too-many-statements
if args.version:
print(version.version())
print(version.version(short=True))
print()
print()
print(qutebrowser.__copyright__)

View File

@ -184,33 +184,41 @@ def _os_info():
return lines
def version():
"""Return a string with various version informations."""
def version(short=False):
"""Return a string with various version informations.
Args:
short: Return a shortened output.
"""
lines = ["qutebrowser v{}".format(qutebrowser.__version__)]
gitver = _git_str()
if gitver is not None:
lines.append("Git commit: {}".format(gitver))
style = QApplication.instance().style()
lines += [
'',
'{}: {}'.format(platform.python_implementation(),
platform.python_version()),
'Qt: {}, runtime: {}'.format(QT_VERSION_STR, qVersion()),
'PyQt: {}'.format(PYQT_VERSION_STR),
'Style: {}'.format(style.metaObject().className()),
'Desktop: {}'.format(os.environ.get('DESKTOP_SESSION')),
]
lines += _module_versions()
if not short:
style = QApplication.instance().style()
lines += [
'Style: {}'.format(style.metaObject().className()),
'Desktop: {}'.format(os.environ.get('DESKTOP_SESSION')),
]
lines += [
'Webkit: {}'.format(qWebKitVersion()),
'Harfbuzz: {}'.format(os.environ.get('QT_HARFBUZZ', 'system')),
'SSL: {}'.format(QSslSocket.sslLibraryVersionString()),
'',
'Frozen: {}'.format(hasattr(sys, 'frozen')),
'Platform: {}, {}'.format(platform.platform(),
platform.architecture()[0]),
]
lines += _os_info()
lines += _module_versions()
lines += [
'Webkit: {}'.format(qWebKitVersion()),
'Harfbuzz: {}'.format(os.environ.get('QT_HARFBUZZ', 'system')),
'SSL: {}'.format(QSslSocket.sslLibraryVersionString()),
'',
'Frozen: {}'.format(hasattr(sys, 'frozen')),
'Platform: {}, {}'.format(platform.platform(),
platform.architecture()[0]),
]
lines += _os_info()
return '\n'.join(lines)