__init__.py 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. """
  2. An enhanced distutils, providing support for Fortran compilers, for BLAS,
  3. LAPACK and other common libraries for numerical computing, and more.
  4. Public submodules are::
  5. misc_util
  6. system_info
  7. cpu_info
  8. log
  9. exec_command
  10. For details, please see the *Packaging* and *NumPy Distutils User Guide*
  11. sections of the NumPy Reference Guide.
  12. For configuring the preference for and location of libraries like BLAS and
  13. LAPACK, and for setting include paths and similar build options, please see
  14. ``site.cfg.example`` in the root of the NumPy repository or sdist.
  15. """
  16. import warnings
  17. # Must import local ccompiler ASAP in order to get
  18. # customized CCompiler.spawn effective.
  19. from . import ccompiler
  20. from . import unixccompiler
  21. from .npy_pkg_config import *
  22. warnings.warn("\n\n"
  23. " `numpy.distutils` is deprecated since NumPy 1.23.0, as a result\n"
  24. " of the deprecation of `distutils` itself. It will be removed for\n"
  25. " Python >= 3.12. For older Python versions it will remain present.\n"
  26. " It is recommended to use `setuptools < 60.0` for those Python versions.\n"
  27. " For more details, see:\n"
  28. " https://numpy.org/devdocs/reference/distutils_status_migration.html \n\n",
  29. DeprecationWarning, stacklevel=2
  30. )
  31. del warnings
  32. # If numpy is installed, add distutils.test()
  33. try:
  34. from . import __config__
  35. # Normally numpy is installed if the above import works, but an interrupted
  36. # in-place build could also have left a __config__.py. In that case the
  37. # next import may still fail, so keep it inside the try block.
  38. from numpy._pytesttester import PytestTester
  39. test = PytestTester(__name__)
  40. del PytestTester
  41. except ImportError:
  42. pass
  43. def customized_fcompiler(plat=None, compiler=None):
  44. from numpy.distutils.fcompiler import new_fcompiler
  45. c = new_fcompiler(plat=plat, compiler=compiler)
  46. c.customize()
  47. return c
  48. def customized_ccompiler(plat=None, compiler=None, verbose=1):
  49. c = ccompiler.new_compiler(plat=plat, compiler=compiler, verbose=verbose)
  50. c.customize('')
  51. return c