Improve version info
This commit is contained in:
parent
b91b6038c6
commit
b3fa7bba98
@ -30,7 +30,7 @@ from base64 import b64encode
|
|||||||
# Print a nice traceback on segfault -- only available on Python 3.3+, but if
|
# Print a nice traceback on segfault -- only available on Python 3.3+, but if
|
||||||
# it's unavailable, it doesn't matter much.
|
# it's unavailable, it doesn't matter much.
|
||||||
try:
|
try:
|
||||||
import faulthandler
|
import faulthandler # pylint: disable=import-error
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
"""Utilities to show various version informations."""
|
"""Utilities to show various version informations."""
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
import glob
|
||||||
import os.path
|
import os.path
|
||||||
import platform
|
import platform
|
||||||
import subprocess
|
import subprocess
|
||||||
@ -53,31 +54,67 @@ def _git_str():
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _release_info():
|
||||||
|
"""Try to gather distribution release informations.
|
||||||
|
|
||||||
|
Return:
|
||||||
|
list of (filename, content) tuples.
|
||||||
|
"""
|
||||||
|
data = []
|
||||||
|
for fn in glob.glob("/etc/*-release"):
|
||||||
|
try:
|
||||||
|
with open(fn, 'r') as f:
|
||||||
|
data.append((fn, ''.join(f.readlines())))
|
||||||
|
except IOError:
|
||||||
|
pass
|
||||||
|
return data
|
||||||
|
|
||||||
def version():
|
def version():
|
||||||
"""Return a string with various version informations."""
|
"""Return a string with various version informations."""
|
||||||
|
releaseinfo = None
|
||||||
if sys.platform == 'linux':
|
if sys.platform == 'linux':
|
||||||
osver = ', '.join((platform.dist()))
|
osver = ', '.join([e for e in platform.dist() if e])
|
||||||
|
releaseinfo = _release_info()
|
||||||
elif sys.platform == 'win32':
|
elif sys.platform == 'win32':
|
||||||
osver = ', '.join((platform.win32_ver()))
|
osver = ', '.join(platform.win32_ver())
|
||||||
elif sys.platform == 'darwin':
|
elif sys.platform == 'darwin':
|
||||||
osver = ', '.join((platform.mac_ver()))
|
osver = ', '.join(platform.mac_ver())
|
||||||
else:
|
else:
|
||||||
osver = '?'
|
osver = '?'
|
||||||
|
|
||||||
gitver = _git_str()
|
gitver = _git_str()
|
||||||
|
|
||||||
lines = [
|
lines = [
|
||||||
'qutebrowser v{}\n\n'.format(qutebrowser.__version__),
|
'qutebrowser v{}'.format(qutebrowser.__version__),
|
||||||
'Python {}\n'.format(platform.python_version()),
|
'',
|
||||||
'Qt {}, runtime {}\n'.format(QT_VERSION_STR, qVersion()),
|
'{} {}'.format(platform.python_implementation(),
|
||||||
'PyQt {}\n'.format(PYQT_VERSION_STR),
|
platform.python_version()),
|
||||||
'Webkit {}\n\n'.format(qWebKitVersion()),
|
'Qt {}, runtime {}'.format(QT_VERSION_STR, qVersion()),
|
||||||
'Platform: {}, {}\n'.format(platform.platform(),
|
'PyQt {}'.format(PYQT_VERSION_STR),
|
||||||
platform.architecture()[0]),
|
|
||||||
'OS Version: {}\n'.format(osver),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
if gitver is not None:
|
try:
|
||||||
lines.append('\nGit commit: {}'.format(gitver))
|
import sipconfig # pylint: disable=import-error
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
lines.append('SIP {}'.format(
|
||||||
|
sipconfig.Configuration().sip_version_str))
|
||||||
|
|
||||||
return ''.join(lines)
|
lines += [
|
||||||
|
'Webkit {}'.format(qWebKitVersion()),
|
||||||
|
'',
|
||||||
|
'Platform: {}, {}'.format(platform.platform(),
|
||||||
|
platform.architecture()[0]),
|
||||||
|
'OS Version: {}'.format(osver),
|
||||||
|
]
|
||||||
|
|
||||||
|
if releaseinfo is not None:
|
||||||
|
for (fn, data) in releaseinfo:
|
||||||
|
lines += ['', '--- {} ---'.format(fn), data]
|
||||||
|
lines.append('')
|
||||||
|
|
||||||
|
if gitver is not None:
|
||||||
|
lines.append('Git commit: {}'.format(gitver))
|
||||||
|
|
||||||
|
return '\n'.join(lines)
|
||||||
|
Loading…
Reference in New Issue
Block a user