Coverage for /usr/lib/python3/dist-packages/scipy/__config__.py: 48%

27 statements  

« prev     ^ index     » next       coverage.py v7.9.1, created at 2025-06-14 15:55 +0200

1# This file is generated by SciPy's build process 

2# It contains system_info results at the time of building this package. 

3from enum import Enum 

4 

5__all__ = ["show"] 

6_built_with_meson = True 

7 

8 

9class DisplayModes(Enum): 

10 stdout = "stdout" 

11 dicts = "dicts" 

12 

13 

14def _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 

25CONFIG = _cleanup( 

26 { 

27 "Compilers": { 

28 "c": { 

29 "name": "gcc", 

30 "linker": "ld.bfd", 

31 "version": "13.2.0", 

32 "commands": "cc", 

33 }, 

34 "cython": { 

35 "name": "cython", 

36 "linker": "cython", 

37 "version": "0.29.37", 

38 "commands": "cython3", 

39 }, 

40 "c++": { 

41 "name": "gcc", 

42 "linker": "ld.bfd", 

43 "version": "13.2.0", 

44 "commands": "c++", 

45 }, 

46 "fortran": { 

47 "name": "gcc", 

48 "linker": "ld.bfd", 

49 "version": "13.2.0", 

50 "commands": "gfortran", 

51 }, 

52 "pythran": { 

53 "version": "0.15.0", 

54 "include directory": r"../../../../usr/lib/python3/dist-packages/pythran" 

55 }, 

56 }, 

57 "Machine Information": { 

58 "host": { 

59 "cpu": "x86_64", 

60 "family": "x86_64", 

61 "endian": "little", 

62 "system": "linux", 

63 }, 

64 "build": { 

65 "cpu": "x86_64", 

66 "family": "x86_64", 

67 "endian": "little", 

68 "system": "linux", 

69 }, 

70 "cross-compiled": bool("False".lower().replace('false', '')), 

71 }, 

72 "Build Dependencies": { 

73 "blas": { 

74 "name": "blas", 

75 "found": bool("True".lower().replace('false', '')), 

76 "version": "3.12.0", 

77 "detection method": "pkgconfig", 

78 "include directory": r"/usr/include/x86_64-linux-gnu", 

79 "lib directory": r"/usr/lib/x86_64-linux-gnu", 

80 "openblas configuration": "unknown", 

81 "pc file directory": r"/usr/lib/x86_64-linux-gnu/pkgconfig", 

82 }, 

83 "lapack": { 

84 "name": "lapack", 

85 "found": bool("True".lower().replace('false', '')), 

86 "version": "3.12.0", 

87 "detection method": "pkgconfig", 

88 "include directory": r"/usr/include/x86_64-linux-gnu", 

89 "lib directory": r"/usr/lib/x86_64-linux-gnu", 

90 "openblas configuration": "unknown", 

91 "pc file directory": r"/usr/lib/x86_64-linux-gnu/pkgconfig", 

92 }, 

93 "pybind11": { 

94 "name": "pybind11", 

95 "version": "2.11.1", 

96 "detection method": "pkgconfig", 

97 "include directory": r"/usr/include", 

98 }, 

99 }, 

100 "Python Information": { 

101 "path": r"/usr/bin/python3.12", 

102 "version": "3.12", 

103 }, 

104 } 

105) 

106 

107 

108def _check_pyyaml(): 

109 import yaml 

110 

111 return yaml 

112 

113 

114def show(mode=DisplayModes.stdout.value): 

115 """ 

116 Show libraries and system information on which SciPy was built 

117 and is being used 

118 

119 Parameters 

120 ---------- 

121 mode : {`'stdout'`, `'dicts'`}, optional. 

122 Indicates how to display the config information. 

123 `'stdout'` prints to console, `'dicts'` returns a dictionary 

124 of the configuration. 

125 

126 Returns 

127 ------- 

128 out : {`dict`, `None`} 

129 If mode is `'dicts'`, a dict is returned, else None 

130 

131 Notes 

132 ----- 

133 1. The `'stdout'` mode will give more readable 

134 output if ``pyyaml`` is installed 

135 

136 """ 

137 if mode == DisplayModes.stdout.value: 

138 try: # Non-standard library, check import 

139 yaml = _check_pyyaml() 

140 

141 print(yaml.dump(CONFIG)) 

142 except ModuleNotFoundError: 

143 import warnings 

144 import json 

145 

146 warnings.warn("Install `pyyaml` for better output", stacklevel=1) 

147 print(json.dumps(CONFIG, indent=2)) 

148 elif mode == DisplayModes.dicts.value: 

149 return CONFIG 

150 else: 

151 raise AttributeError( 

152 f"Invalid `mode`, use one of: {', '.join([e.value for e in DisplayModes])}" 

153 )