Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/scipy/__config__.py: 48%

27 statements  

« prev     ^ index     » next       coverage.py v7.3.2, created at 2023-12-12 06:31 +0000

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": "10.2.1", 

32 "commands": "cc", 

33 }, 

34 "cython": { 

35 "name": "cython", 

36 "linker": "cython", 

37 "version": "0.29.33", 

38 "commands": "cython", 

39 }, 

40 "c++": { 

41 "name": "gcc", 

42 "linker": "ld.bfd", 

43 "version": "10.2.1", 

44 "commands": "c++", 

45 }, 

46 "fortran": { 

47 "name": "gcc", 

48 "linker": "ld.bfd", 

49 "version": "10.2.1", 

50 "commands": "gfortran", 

51 }, 

52 "pythran": { 

53 "version": "0.12.1", 

54 "include directory": r"/tmp/pip-build-env-q2fwe5jt/overlay/lib/python3.8/site-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": "OpenBLAS", 

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

76 "version": "0.3.18", 

77 "detection method": "cmake", 

78 "include directory": r"unknown", 

79 "lib directory": r"unknown", 

80 "openblas configuration": "unknown", 

81 "pc file directory": r"unknown", 

82 }, 

83 "lapack": { 

84 "name": "OpenBLAS", 

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

86 "version": "0.3.18", 

87 "detection method": "cmake", 

88 "include directory": r"unknown", 

89 "lib directory": r"unknown", 

90 "openblas configuration": "unknown", 

91 "pc file directory": r"unknown", 

92 }, 

93 }, 

94 "Python Information": { 

95 "path": r"/opt/python/cp38-cp38/bin/python", 

96 "version": "3.8", 

97 }, 

98 } 

99) 

100 

101 

102def _check_pyyaml(): 

103 import yaml 

104 

105 return yaml 

106 

107 

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

109 """ 

110 Show libraries and system information on which SciPy was built 

111 and is being used 

112 

113 Parameters 

114 ---------- 

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

116 Indicates how to display the config information. 

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

118 of the configuration. 

119 

120 Returns 

121 ------- 

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

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

124 

125 Notes 

126 ----- 

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

128 output if ``pyyaml`` is installed 

129 

130 """ 

131 if mode == DisplayModes.stdout.value: 

132 try: # Non-standard library, check import 

133 yaml = _check_pyyaml() 

134 

135 print(yaml.dump(CONFIG)) 

136 except ModuleNotFoundError: 

137 import warnings 

138 import json 

139 

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

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

142 elif mode == DisplayModes.dicts.value: 

143 return CONFIG 

144 else: 

145 raise AttributeError( 

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

147 )