(info_add)
| 220 | |
| 221 | |
| 222 | def collect_os(info_add): |
| 223 | import os |
| 224 | |
| 225 | def format_attr(attr, value): |
| 226 | if attr in ('supports_follow_symlinks', 'supports_fd', |
| 227 | 'supports_effective_ids'): |
| 228 | return str(sorted(func.__name__ for func in value)) |
| 229 | else: |
| 230 | return value |
| 231 | |
| 232 | attributes = ( |
| 233 | 'name', |
| 234 | 'supports_bytes_environ', |
| 235 | 'supports_effective_ids', |
| 236 | 'supports_fd', |
| 237 | 'supports_follow_symlinks', |
| 238 | ) |
| 239 | copy_attributes(info_add, os, 'os.%s', attributes, formatter=format_attr) |
| 240 | |
| 241 | for func in ( |
| 242 | 'cpu_count', |
| 243 | 'getcwd', |
| 244 | 'getegid', |
| 245 | 'geteuid', |
| 246 | 'getgid', |
| 247 | 'getloadavg', |
| 248 | 'getresgid', |
| 249 | 'getresuid', |
| 250 | 'getuid', |
| 251 | 'process_cpu_count', |
| 252 | 'uname', |
| 253 | ): |
| 254 | call_func(info_add, 'os.%s' % func, os, func) |
| 255 | |
| 256 | def format_groups(groups): |
| 257 | return ', '.join(map(str, groups)) |
| 258 | |
| 259 | call_func(info_add, 'os.getgroups', os, 'getgroups', formatter=format_groups) |
| 260 | |
| 261 | if hasattr(os, 'getlogin'): |
| 262 | try: |
| 263 | login = os.getlogin() |
| 264 | except OSError: |
| 265 | # getlogin() fails with "OSError: [Errno 25] Inappropriate ioctl |
| 266 | # for device" on Travis CI |
| 267 | pass |
| 268 | else: |
| 269 | info_add("os.login", login) |
| 270 | |
| 271 | # Environment variables used by the stdlib and tests. Don't log the full |
| 272 | # environment: filter to list to not leak sensitive information. |
| 273 | # |
| 274 | # HTTP_PROXY is not logged because it can contain a password. |
| 275 | ENV_VARS = frozenset(( |
| 276 | "APPDATA", |
| 277 | "AR", |
| 278 | "ARCHFLAGS", |
| 279 | "ARFLAGS", |
nothing calls this directly
no test coverage detected
searching dependent graphs…