()
return _SYSTEM_VERSION
Return the OS X system version as a string
Return the OS X system version as a string
Return the OS X system version as a string
def _get_system_version():
    """Return the OS X system version as a string"""
    # Reading this plist is a documented way to get the system
    # version (see the documentation for the Gestalt Manager)
    # We avoid using platform.mac_ver to avoid possible bootstrap issues during
    # the build of Python itself (distutils is used to build standard library
    # extensions).

    global _SYSTEM_VERSION

    if _SYSTEM_VERSION is None:
        _SYSTEM_VERSION = ''
        try:
            f = open('/System/Library/CoreServices/SystemVersion.plist', encoding="utf-8")
        except OSError:
            # We're on a plain darwin box, fall back to the default
            # behaviour.
            pass
        else:
            try:
                m = re.search(r'<key>ProductUserVisibleVersion</key>\s*'
                              r'<string>(.*?)</string>', f.read())
            finally:
                f.close()
            if m is not None:
                _SYSTEM_VERSION = '.'.join(m.group(1).split('.')[:2])
            # else: fall back to the default behaviour

    return _SYSTEM_VERSION
def _get_system_version ( ) : # Reading this plist is a documented way to get the system # version (see the documentation for the Gestalt Manager) # We avoid using platform.mac_ver to avoid possible bootstrap issues during # the build of Python itself (distutils is used to build standard library # extensions). global _SYSTEM_VERSION if _SYSTEM_VERSION is None : _SYSTEM_VERSION = '' try : f = open ( '/System/Library/CoreServices/SystemVersion.plist' , encoding = "utf-8" ) except OSError : # We're on a plain darwin box, fall back to the default # behaviour. pass else : try : m = re . search ( r'<key>ProductUserVisibleVersion</key>\s*' r'<string>(.*?)</string>' , f . read ( ) ) finally : f . close ( ) if m is not None : _SYSTEM_VERSION = '.' . join ( m . group ( 1 ) . split ( '.' ) [ : 2 ] ) # else: fall back to the default behaviour return _SYSTEM_VERSION