MCPcopy Index your code
hub / github.com/RustPython/RustPython / _get_system_version

Function _get_system_version

Lib/_osx_support.py:86–114  ·  view source on GitHub ↗

Return the OS X system version as a string

()

Source from the content-addressed store, hash-verified

84_SYSTEM_VERSION = None
85
86def _get_system_version():
87 """Return the OS X system version as a string"""
88 # Reading this plist is a documented way to get the system
89 # version (see the documentation for the Gestalt Manager)
90 # We avoid using platform.mac_ver to avoid possible bootstrap issues during
91 # the build of Python itself (distutils is used to build standard library
92 # extensions).
93
94 global _SYSTEM_VERSION
95
96 if _SYSTEM_VERSION is None:
97 _SYSTEM_VERSION = ''
98 try:
99 f = open('/System/Library/CoreServices/SystemVersion.plist', encoding="utf-8")
100 except OSError:
101 # We're on a plain darwin box, fall back to the default
102 # behaviour.
103 pass
104 else:
105 try:
106 m = re.search(r'<key>ProductUserVisibleVersion</key>\s*'
107 r'<string>(.*?)</string>', f.read())
108 finally:
109 f.close()
110 if m is not None:
111 _SYSTEM_VERSION = '.'.join(m.group(1).split('.')[:2])
112 # else: fall back to the default behaviour
113
114 return _SYSTEM_VERSION
115
116_SYSTEM_VERSION_TUPLE = None
117def _get_system_version_tuple():

Callers 2

get_platform_osxFunction · 0.85

Calls 7

openFunction · 0.70
searchMethod · 0.45
readMethod · 0.45
closeMethod · 0.45
joinMethod · 0.45
splitMethod · 0.45
groupMethod · 0.45

Tested by

no test coverage detected