@@ -18,6 +18,41 @@ if is_mingw
18
18
add_project_arguments (' -mlong-double-64' , language : ' c' )
19
19
endif
20
20
21
+ # Only check build dependencies version when not cross-compiling, as running
22
+ # Python interpreter can be tricky in cross-compilation settings. For more
23
+ # details, see https://docs.scipy.org/doc/scipy/building/cross_compilation.html
24
+ if not meson .is_cross_build()
25
+ if not py.version().version_compare(' >=3.9' )
26
+ error (' scikit-learn requires Python>=3.9, got ' + py.version() + ' instead' )
27
+ endif
28
+
29
+ cython_min_version = run_command (py, [' _min_dependencies.py' , ' cython' ], check : true ).stdout().strip()
30
+ if not cython.version().version_compare(' >=' + cython_min_version)
31
+ error (' scikit-learn requires Cython>=' + cython_min_version + ' , got ' + cython.version() + ' instead' )
32
+ endif
33
+
34
+ meson_python_version = run_command (py,
35
+ [' -c' , ' import mesonpy; print(mesonpy.__version__)' ], check : true ).stdout().strip()
36
+ meson_python_min_version = run_command (py, [' _min_dependencies.py' , ' meson-python' ], check : true ).stdout().strip()
37
+ if not meson_python_version.version_compare(' >=' + meson_python_min_version)
38
+ error (' scikit-learn requires meson-python>=' + meson_python_min_version + ' , got ' + meson_python_version + ' instead' )
39
+ endif
40
+
41
+ numpy_version = run_command (py,
42
+ [' -c' , ' import numpy; print(numpy.__version__)' ], check : true ).stdout().strip()
43
+ numpy_min_version = run_command (py, [' _min_dependencies.py' , ' numpy' ], check : true ).stdout().strip()
44
+ if not numpy_version.version_compare(' >=' + numpy_min_version)
45
+ error (' scikit-learn requires numpy>=' + numpy_min_version + ' , got ' + numpy_version + ' instead' )
46
+ endif
47
+
48
+ scipy_version = run_command (py,
49
+ [' -c' , ' import scipy; print(scipy.__version__)' ], check : true ).stdout().strip()
50
+ scipy_min_version = run_command (py, [' _min_dependencies.py' , ' scipy' ], check : true ).stdout().strip()
51
+ if not scipy_version.version_compare(' >=' + scipy_min_version)
52
+ error (' scikit-learn requires scipy>=' + scipy_min_version + ' , got ' + scipy_version + ' instead' )
53
+ endif
54
+ endif
55
+
21
56
# Adapted from scipy, each project seems to have its own tweaks for this. One
22
57
# day using dependency('numpy') will be a thing, see
23
58
# https://github.com/mesonbuild/meson/issues/9598.
0 commit comments