MCPcopy Index your code
hub / github.com/python/cpython / collect_platform

Function collect_platform

Lib/test/pythoninfo.py:152–189  ·  view source on GitHub ↗
(info_add)

Source from the content-addressed store, hash-verified

150
151
152def collect_platform(info_add):
153 import platform
154
155 arch = platform.architecture()
156 arch = ' '.join(filter(bool, arch))
157 info_add('platform.architecture', arch)
158
159 info_add('platform.python_implementation',
160 platform.python_implementation())
161 info_add('platform.platform',
162 platform.platform(aliased=True))
163
164 libc_ver = ('%s %s' % platform.libc_ver()).strip()
165 if libc_ver:
166 info_add('platform.libc_ver', libc_ver)
167
168 try:
169 os_release = platform.freedesktop_os_release()
170 except OSError:
171 pass
172 else:
173 for key in (
174 'ID',
175 'NAME',
176 'PRETTY_NAME'
177 'VARIANT',
178 'VARIANT_ID',
179 'VERSION',
180 'VERSION_CODENAME',
181 'VERSION_ID',
182 ):
183 if key not in os_release:
184 continue
185 info_add(f'platform.freedesktop_os_release[{key}]',
186 os_release[key])
187
188 if sys.platform == 'android':
189 call_func(info_add, 'platform.android_ver', platform, 'android_ver')
190
191
192def collect_locale(info_add):

Callers

nothing calls this directly

Calls 4

call_funcFunction · 0.85
filterFunction · 0.50
joinMethod · 0.45
stripMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…