util.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:solaris-ips 作者: oracle 项目源码 文件源码
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'
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号