sb: Add platform reporting for better host reviewing in posted email reports.

This commit is contained in:
Chris Johns
2017-10-31 11:57:21 +11:00
parent 4e7fdaf15d
commit 4dc9bf3a37
2 changed files with 25 additions and 5 deletions

View File

@@ -64,6 +64,18 @@ def _make_path(p, *args):
p = path.join(p, arg)
return os.path.abspath(path.host(p))
def platform(mode = 'all'):
import platform
if mode == 'system':
return platform.system()
compact = platform.platform(aliased = True)
if mode == 'compact':
return compact
extended = ' '.join(platform.uname())
if mode == 'extended':
return extended
return '%s (%s)' % (short, extended)
class formatter(object):
def __init__(self):
self.content = ''