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

Function collect_platform

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected