File: python_info.py

package info (click to toggle)
blake3-py 1.0.4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,016 kB
  • sloc: asm: 17,520; ansic: 4,109; python: 587; makefile: 15
file content (35 lines) | stat: -rw-r--r-- 1,045 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# This script is for printing debug information in CI, to help with tracking
# down configuration errosr. It's similar to what PyO3 use to detect the Python
# version.

import sys
import sysconfig
import platform
import json

PYPY = platform.python_implementation() == "PyPy"

try:
    base_prefix = sys.base_prefix
except AttributeError:
    base_prefix = sys.exec_prefix

info = {
    "version": {
        "major": sys.version_info[0],
        "minor": sys.version_info[1],
        "implementation": platform.python_implementation(),
    },
    "libdir": sysconfig.get_config_var("LIBDIR"),
    "ld_version": sysconfig.get_config_var("LDVERSION")
    or sysconfig.get_config_var("py_version_short"),
    "base_prefix": base_prefix,
    "shared": PYPY or bool(sysconfig.get_config_var("Py_ENABLE_SHARED")),
    "executable": sys.executable,
    "machine": platform.machine(),
    "maxsize_bits": sys.maxsize.bit_length(),
    "architecture": platform.architecture(),
    "platform": platform.platform(),
}

print(json.dumps(info, indent="  "))