__config__.py 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. # This file is generated by SciPy's build process
  2. # It contains system_info results at the time of building this package.
  3. from enum import Enum
  4. __all__ = ["show"]
  5. _built_with_meson = True
  6. class DisplayModes(Enum):
  7. stdout = "stdout"
  8. dicts = "dicts"
  9. def _cleanup(d):
  10. """
  11. Removes empty values in a `dict` recursively
  12. This ensures we remove values that Meson could not provide to CONFIG
  13. """
  14. if isinstance(d, dict):
  15. return { k: _cleanup(v) for k, v in d.items() if v != '' and _cleanup(v) != '' }
  16. else:
  17. return d
  18. CONFIG = _cleanup(
  19. {
  20. "Compilers": {
  21. "c": {
  22. "name": "gcc",
  23. "linker": "ld.bfd",
  24. "version": "10.2.1",
  25. "commands": "cc",
  26. },
  27. "cython": {
  28. "name": "cython",
  29. "linker": "cython",
  30. "version": "0.29.33",
  31. "commands": "cython",
  32. },
  33. "c++": {
  34. "name": "gcc",
  35. "linker": "ld.bfd",
  36. "version": "10.2.1",
  37. "commands": "c++",
  38. },
  39. "fortran": {
  40. "name": "gcc",
  41. "linker": "ld.bfd",
  42. "version": "10.2.1",
  43. "commands": "gfortran",
  44. },
  45. "pythran": {
  46. "version": "0.12.1",
  47. "include directory": r"/tmp/pip-build-env-81cpj_tz/overlay/lib/python3.8/site-packages/pythran"
  48. },
  49. },
  50. "Machine Information": {
  51. "host": {
  52. "cpu": "aarch64",
  53. "family": "aarch64",
  54. "endian": "little",
  55. "system": "linux",
  56. },
  57. "build": {
  58. "cpu": "aarch64",
  59. "family": "aarch64",
  60. "endian": "little",
  61. "system": "linux",
  62. },
  63. "cross-compiled": bool("False".lower().replace('false', '')),
  64. },
  65. "Build Dependencies": {
  66. "blas": {
  67. "name": "OpenBLAS",
  68. "found": bool("True".lower().replace('false', '')),
  69. "version": "0.3.18",
  70. "detection method": "cmake",
  71. "include directory": r"unknown",
  72. "lib directory": r"unknown",
  73. "openblas configuration": "unknown",
  74. "pc file directory": r"unknown",
  75. },
  76. "lapack": {
  77. "name": "OpenBLAS",
  78. "found": bool("True".lower().replace('false', '')),
  79. "version": "0.3.18",
  80. "detection method": "cmake",
  81. "include directory": r"unknown",
  82. "lib directory": r"unknown",
  83. "openblas configuration": "unknown",
  84. "pc file directory": r"unknown",
  85. },
  86. },
  87. "Python Information": {
  88. "path": r"/opt/python/cp38-cp38/bin/python",
  89. "version": "3.8",
  90. },
  91. }
  92. )
  93. def _check_pyyaml():
  94. import yaml
  95. return yaml
  96. def show(mode=DisplayModes.stdout.value):
  97. """
  98. Show libraries and system information on which SciPy was built
  99. and is being used
  100. Parameters
  101. ----------
  102. mode : {`'stdout'`, `'dicts'`}, optional.
  103. Indicates how to display the config information.
  104. `'stdout'` prints to console, `'dicts'` returns a dictionary
  105. of the configuration.
  106. Returns
  107. -------
  108. out : {`dict`, `None`}
  109. If mode is `'dicts'`, a dict is returned, else None
  110. Notes
  111. -----
  112. 1. The `'stdout'` mode will give more readable
  113. output if ``pyyaml`` is installed
  114. """
  115. if mode == DisplayModes.stdout.value:
  116. try: # Non-standard library, check import
  117. yaml = _check_pyyaml()
  118. print(yaml.dump(CONFIG))
  119. except ModuleNotFoundError:
  120. import warnings
  121. import json
  122. warnings.warn("Install `pyyaml` for better output", stacklevel=1)
  123. print(json.dumps(CONFIG, indent=2))
  124. elif mode == DisplayModes.dicts.value:
  125. return CONFIG
  126. else:
  127. raise AttributeError(
  128. f"Invalid `mode`, use one of: {', '.join([e.value for e in DisplayModes])}"
  129. )