Clean up version info gathering
This commit is contained in:
parent
a3e5d5056e
commit
742bc83ea3
@ -127,38 +127,16 @@ def _release_info():
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
def version():
|
def _module_versions():
|
||||||
"""Return a string with various version informations."""
|
"""Get versions of optional modules.
|
||||||
releaseinfo = None
|
|
||||||
if sys.platform == 'linux':
|
|
||||||
osver = ', '.join([e for e in platform.dist() if e])
|
|
||||||
releaseinfo = _release_info()
|
|
||||||
elif sys.platform == 'win32':
|
|
||||||
osver = ', '.join(platform.win32_ver())
|
|
||||||
elif sys.platform == 'darwin':
|
|
||||||
osver = ', '.join(platform.mac_ver())
|
|
||||||
else:
|
|
||||||
osver = '?'
|
|
||||||
|
|
||||||
gitver = _git_str()
|
|
||||||
|
|
||||||
lines = [
|
|
||||||
"qutebrowser v{}".format(qutebrowser.__version__),
|
|
||||||
]
|
|
||||||
|
|
||||||
if gitver is not None:
|
|
||||||
lines.append("Git commit: {}".format(gitver))
|
|
||||||
|
|
||||||
lines += [
|
|
||||||
'',
|
|
||||||
'{} {}'.format(platform.python_implementation(),
|
|
||||||
platform.python_version()),
|
|
||||||
'Qt {}, runtime {}'.format(QT_VERSION_STR, qVersion()),
|
|
||||||
'PyQt {}'.format(PYQT_VERSION_STR),
|
|
||||||
]
|
|
||||||
|
|
||||||
|
Return:
|
||||||
|
A list of lines with version info.
|
||||||
|
"""
|
||||||
|
# pylint: disable=import-error, unused-variable
|
||||||
|
lines = []
|
||||||
try:
|
try:
|
||||||
import sipconfig # pylint: disable=import-error
|
import sipconfig
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
@ -169,39 +147,75 @@ def version():
|
|||||||
lines.append('SIP ?')
|
lines.append('SIP ?')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import ipdb # pylint: disable=import-error
|
import ipdb
|
||||||
import IPython
|
import IPython
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
version = getattr(IPython, '__version__', 'yes')
|
ver = getattr(IPython, '__version__', 'yes')
|
||||||
lines.append('ipdb/IPython {}'.format(IPython.__version__))
|
lines.append('ipdb/IPython {}'.format(ver))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import colorlog # pylint: disable=import-error
|
import colorlog
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
lines.append('colorlog: yes')
|
lines.append('colorlog: yes')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import colorama # pylint: disable=import-error
|
import colorama
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
version = getattr(colorama, 'VERSION', 'yes')
|
ver = getattr(colorama, 'VERSION', 'yes')
|
||||||
lines.append('colorama: {}'.format(version))
|
lines.append('colorama: {}'.format(ver))
|
||||||
|
|
||||||
|
return lines
|
||||||
|
|
||||||
|
|
||||||
|
def _os_info():
|
||||||
|
"""Get operating system info.
|
||||||
|
|
||||||
|
Return:
|
||||||
|
A list of lines with version info.
|
||||||
|
"""
|
||||||
|
lines = []
|
||||||
|
releaseinfo = None
|
||||||
|
if sys.platform == 'linux':
|
||||||
|
osver = ', '.join([e for e in platform.dist() if e])
|
||||||
|
releaseinfo = _release_info()
|
||||||
|
elif sys.platform == 'win32':
|
||||||
|
osver = ', '.join(platform.win32_ver())
|
||||||
|
elif sys.platform == 'darwin':
|
||||||
|
osver = ', '.join(platform.mac_ver())
|
||||||
|
else:
|
||||||
|
osver = '?'
|
||||||
|
lines.append('OS Version: {}'.format(osver))
|
||||||
|
if releaseinfo is not None:
|
||||||
|
for (fn, data) in releaseinfo:
|
||||||
|
lines += ['', '--- {} ---'.format(fn), data]
|
||||||
|
return lines
|
||||||
|
|
||||||
|
|
||||||
|
def version():
|
||||||
|
"""Return a string with various version informations."""
|
||||||
|
lines = ["qutebrowser v{}".format(qutebrowser.__version__)]
|
||||||
|
gitver = _git_str()
|
||||||
|
if gitver is not None:
|
||||||
|
lines.append("Git commit: {}".format(gitver))
|
||||||
|
lines += [
|
||||||
|
'',
|
||||||
|
'{} {}'.format(platform.python_implementation(),
|
||||||
|
platform.python_version()),
|
||||||
|
'Qt {}, runtime {}'.format(QT_VERSION_STR, qVersion()),
|
||||||
|
'PyQt {}'.format(PYQT_VERSION_STR),
|
||||||
|
]
|
||||||
|
lines += _module_versions()
|
||||||
lines += [
|
lines += [
|
||||||
'Webkit {}'.format(qWebKitVersion()),
|
'Webkit {}'.format(qWebKitVersion()),
|
||||||
'',
|
'',
|
||||||
'Platform: {}, {}'.format(platform.platform(),
|
'Platform: {}, {}'.format(platform.platform(),
|
||||||
platform.architecture()[0]),
|
platform.architecture()[0]),
|
||||||
'OS Version: {}'.format(osver),
|
|
||||||
]
|
]
|
||||||
|
lines += _os_info()
|
||||||
if releaseinfo is not None:
|
|
||||||
for (fn, data) in releaseinfo:
|
|
||||||
lines += ['', '--- {} ---'.format(fn), data]
|
|
||||||
|
|
||||||
return '\n'.join(lines)
|
return '\n'.join(lines)
|
||||||
|
Loading…
Reference in New Issue
Block a user