Utils.py 文件源码

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

项目:SoCFoundationFlow 作者: mattaw 项目源码 文件源码
def unversioned_sys_platform():
    """
    Return the unversioned platform name.
    Some Python platform names contain versions, that depend on
    the build environment, e.g. linux2, freebsd6, etc.
    This returns the name without the version number. Exceptions are
    os2 and win32, which are returned verbatim.

    :rtype: string
    :return: Unversioned platform name
    """
    s = sys.platform
    if s.startswith('java'):
        # The real OS is hidden under the JVM.
        from java.lang import System
        s = System.getProperty('os.name')
        # see http://lopica.sourceforge.net/os.html for a list of possible values
        if s == 'Mac OS X':
            return 'darwin'
        elif s.startswith('Windows '):
            return 'win32'
        elif s == 'OS/2':
            return 'os2'
        elif s == 'HP-UX':
            return 'hp-ux'
        elif s in ('SunOS', 'Solaris'):
            return 'sunos'
        else: s = s.lower()

    # powerpc == darwin for our purposes
    if s == 'powerpc':
        return 'darwin'
    if s == 'win32' or s == 'os2':
        return s
    if s == 'cli' and os.name == 'nt':
        # ironpython is only on windows as far as we know
        return 'win32'
    return re.split('\d+$', s)[0]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号