You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

89 lines
3.2 KiB

4 years ago
  1. import os
  2. from os.path import join
  3. import warnings
  4. from sklearn._build_utils import maybe_cythonize_extensions
  5. def configuration(parent_package='', top_path=None):
  6. from numpy.distutils.misc_util import Configuration
  7. from numpy.distutils.system_info import get_info, BlasNotFoundError
  8. import numpy
  9. libraries = []
  10. if os.name == 'posix':
  11. libraries.append('m')
  12. config = Configuration('sklearn', parent_package, top_path)
  13. # submodules with build utilities
  14. config.add_subpackage('__check_build')
  15. config.add_subpackage('_build_utils')
  16. # submodules which do not have their own setup.py
  17. # we must manually add sub-submodules & tests
  18. config.add_subpackage('compose')
  19. config.add_subpackage('compose/tests')
  20. config.add_subpackage('covariance')
  21. config.add_subpackage('covariance/tests')
  22. config.add_subpackage('cross_decomposition')
  23. config.add_subpackage('cross_decomposition/tests')
  24. config.add_subpackage('feature_selection')
  25. config.add_subpackage('feature_selection/tests')
  26. config.add_subpackage('gaussian_process')
  27. config.add_subpackage('gaussian_process/tests')
  28. config.add_subpackage('mixture')
  29. config.add_subpackage('mixture/tests')
  30. config.add_subpackage('model_selection')
  31. config.add_subpackage('model_selection/tests')
  32. config.add_subpackage('neural_network')
  33. config.add_subpackage('neural_network/tests')
  34. config.add_subpackage('preprocessing')
  35. config.add_subpackage('preprocessing/tests')
  36. config.add_subpackage('semi_supervised')
  37. config.add_subpackage('semi_supervised/tests')
  38. # submodules which have their own setup.py
  39. # leave out "linear_model" and "utils" for now; add them after cblas below
  40. config.add_subpackage('cluster')
  41. config.add_subpackage('datasets')
  42. config.add_subpackage('decomposition')
  43. config.add_subpackage('ensemble')
  44. config.add_subpackage('externals')
  45. config.add_subpackage('feature_extraction')
  46. config.add_subpackage('manifold')
  47. config.add_subpackage('metrics')
  48. config.add_subpackage('neighbors')
  49. config.add_subpackage('tree')
  50. config.add_subpackage('svm')
  51. # add cython extension module for isotonic regression
  52. config.add_extension('_isotonic',
  53. sources=['_isotonic.pyx'],
  54. include_dirs=[numpy.get_include()],
  55. libraries=libraries,
  56. )
  57. # some libs needs cblas, fortran-compiled BLAS will not be sufficient
  58. blas_info = get_info('blas_opt', 0)
  59. if (not blas_info) or (
  60. ('NO_ATLAS_INFO', 1) in blas_info.get('define_macros', [])):
  61. config.add_library('cblas',
  62. sources=[join('src', 'cblas', '*.c')])
  63. warnings.warn(BlasNotFoundError.__doc__)
  64. # the following packages depend on cblas, so they have to be build
  65. # after the above.
  66. config.add_subpackage('linear_model')
  67. config.add_subpackage('utils')
  68. # add the test directory
  69. config.add_subpackage('tests')
  70. maybe_cythonize_extensions(top_path, config)
  71. return config
  72. if __name__ == '__main__':
  73. from numpy.distutils.core import setup
  74. setup(**configuration(top_path='').todict())