Debian Codegraph @

skmisc/__config__.py.in

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 # This file is generated by scikit-miscs's build process
2 # It contains system_info results at the time of building this package.
3 from enum import Enum
4
5 __all__ = ["show"]
6 _built_with_meson = True
7
8
9 class DisplayModes(Enum):
10 stdout = "stdout"
11 dicts = "dicts"
12
13
14 def _cleanup(d):
15 """
16 Removes empty values in a `dict` recursively
17 This ensures we remove values that Meson could not provide to CONFIG
18 """
19 if isinstance(d, dict):
20 return { k: _cleanup(v) for k, v in d.items() if v != '' and _cleanup(v) != '' }
21 else:
22 return d
23
24
25 CONFIG = _cleanup(
26 {
27 "Compilers": {
28 "c": {
29 "name": "@C_COMP@",
30 "linker": "@C_COMP_LINKER_ID@",
31 "version": "@C_COMP_VERSION@",
32 "commands": "@C_COMP_CMD_ARRAY@",
33 },
34 "cython": {
35 "name": "@CYTHON_COMP@",
36 "linker": "@CYTHON_COMP_LINKER_ID@",
37 "version": "@CYTHON_COMP_VERSION@",
38 "commands": "@CYTHON_COMP_CMD_ARRAY@",
39 },
40 "fortran": {
41 "name": "@FORTRAN_COMP@",
42 "linker": "@FORTRAN_COMP_LINKER_ID@",
43 "version": "@FORTRAN_COMP_VERSION@",
44 "commands": "@FORTRAN_COMP_CMD_ARRAY@",
45 },
46 },
47 "Build Dependencies": {
48 "blas": {
49 "name": "@BLAS_NAME@",
50 "found": bool("@BLAS_FOUND@".lower().replace('false', '')),
51 "version": "@BLAS_VERSION@",
52 "detection method": "@BLAS_TYPE_NAME@",
53 "include directory": r"@BLAS_INCLUDEDIR@",
54 "lib directory": r"@BLAS_LIBDIR@",
55 "openblas configuration": "@BLAS_OPENBLAS_CONFIG@",
56 "pc file directory": r"@BLAS_PCFILEDIR@",
57 },
58 "lapack": {
59 "name": "@LAPACK_NAME@",
60 "found": bool("@LAPACK_FOUND@".lower().replace('false', '')),
61 "version": "@LAPACK_VERSION@",
62 "detection method": "@LAPACK_TYPE_NAME@",
63 "include directory": r"@LAPACK_INCLUDEDIR@",
64 "lib directory": r"@LAPACK_LIBDIR@",
65 "openblas configuration": "@LAPACK_OPENBLAS_CONFIG@",
66 "pc file directory": r"@LAPACK_PCFILEDIR@",
67 },
68 },
69 "Machine Information": {
70 "host": {
71 "cpu": "@HOST_CPU@",
72 "family": "@HOST_CPU_FAMILY@",
73 "endian": "@HOST_CPU_ENDIAN@",
74 "system": "@HOST_CPU_SYSTEM@",
75 },
76 "build": {
77 "cpu": "@BUILD_CPU@",
78 "family": "@BUILD_CPU_FAMILY@",
79 "endian": "@BUILD_CPU_ENDIAN@",
80 "system": "@BUILD_CPU_SYSTEM@",
81 },
82 "cross-compiled": bool("@CROSS_COMPILED@".lower().replace('false', '')),
83 },
84 "Python Information": {
85 "path": r"@PYTHON_PATH@",
86 "version": "@PYTHON_VERSION@",
87 },
88 }
89 )
90
91
92 def _check_pyyaml():
93 import yaml
94
95 return yaml
96
97
98 def show(mode=DisplayModes.stdout.value):
99 """
100 Show libraries and system information on which scikit-misc was built
101 and is being used
102
103 Parameters
104 ----------
105 mode : {`'stdout'`, `'dicts'`}, optional.
106 Indicates how to display the config information.
107 `'stdout'` prints to console, `'dicts'` returns a dictionary
108 of the configuration.
109
110 Returns
111 -------
112 out : {`dict`, `None`}
113 If mode is `'dicts'`, a dict is returned, else None
114
115 Notes
116 -----
117 1. The `'stdout'` mode will give more readable
118 output if ``pyyaml`` is installed
119
120 """
121 if mode == DisplayModes.stdout.value:
122 try: # Non-standard library, check import
123 yaml = _check_pyyaml()
124
125 print(yaml.dump(CONFIG))
126 except ModuleNotFoundError:
127 import warnings
128 import json
129
130 warnings.warn("Install `pyyaml` for better output", stacklevel=1)
131 print(json.dumps(CONFIG, indent=2))
132 elif mode == DisplayModes.dicts.value:
133 return CONFIG
134 else:
135 raise AttributeError(
136 f"Invalid `mode`, use one of: {', '.join([e.value for e in DisplayModes])}"
137 )