def get_canonical_os_name():
"""
Return a standardized, lower case version of the name of the OS. This is
useful to avoid the ambiguity of OS marketing names.
"""
psl = platform.system().lower()
if psl in ['sunos', 'darwin', 'windows', 'aix']:
return psl
if psl == 'linux':
# add distro information for Linux
return 'linux_{0}'.format(platform.dist()[0])
# Workaround for python bug 1082, on Vista, platform.system()
# returns 'Microsoft'
prl = platform.release().lower()
if psl == 'microsoft' or prl == 'vista' or prl == 'windows':
return 'windows'
return 'unknown'
评论列表
文章目录