osinfo.py 文件源码

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

项目:LinuxBashShellScriptForOps 作者: DingGuodong 项目源码 文件源码
def _get_os_type():
    os_type = OSType.unknown[0]

    # Figure out the general OS type
    uname = platform.system().strip().strip('"').strip("'").strip().lower()
    if 'beos' in uname or 'haiku' in uname:
        os_type = OSType.BeOS[0]
    elif 'bsd' in uname or 'gnu/kfreebsd' in uname:
        os_type = OSType.BSD[0]
    elif 'cygwin' in uname:
        os_type = OSType.Cygwin[0]
    elif 'darwin' in uname:
        os_type = OSType.MacOS[0]
    elif 'linux' in uname:
        os_type = OSType.Linux[0]
    elif 'solaris' in uname or 'sunos' in uname:
        os_type = OSType.Solaris[0]
    elif 'windows' in uname:
        os_type = OSType.Windows[0]

    return os_type
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号