| 150 | |
| 151 | |
| 152 | def 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 | |
| 192 | def collect_locale(info_add): |