Skip to content

BLD Do not require meson-python when using meson directly #29578

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions sklearn/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,6 @@ if not meson.is_cross_build()
error('scikit-learn requires Cython>=' + cython_min_version + ', got ' + cython.version() + ' instead')
endif

meson_python_version = run_command(py,
['-c', 'import mesonpy; print(mesonpy.__version__)'], check: true).stdout().strip()
meson_python_min_version = run_command(py, ['_min_dependencies.py', 'meson-python'], check: true).stdout().strip()
if not meson_python_version.version_compare('>=' + meson_python_min_version)
error('scikit-learn requires meson-python>=' + meson_python_min_version + ', got ' + meson_python_version + ' instead')
endif

numpy_version = run_command(py,
['-c', 'import numpy; print(numpy.__version__)'], check: true).stdout().strip()
numpy_min_version = run_command(py, ['_min_dependencies.py', 'numpy'], check: true).stdout().strip()
Expand All @@ -51,6 +44,20 @@ if not meson.is_cross_build()
if not scipy_version.version_compare('>=' + scipy_min_version)
error('scikit-learn requires scipy>=' + scipy_min_version + ', got ' + scipy_version + ' instead')
endif

# meson-python is required only when going through pip. Using meson directly
# should not check meson-python version.
meson_python_version_command_result = run_command(py,
['-c', 'import mesonpy; print(mesonpy.__version__)'], check: false)
meson_python_installed = meson_python_version_command_result.returncode() == 0
if meson_python_installed
meson_python_version = meson_python_version_command_result.stdout().strip()
meson_python_min_version = run_command(py, ['_min_dependencies.py', 'meson-python'], check: true).stdout().strip()
if not meson_python_version.version_compare('>=' + meson_python_min_version)
error('scikit-learn requires meson-python>=' + meson_python_min_version + ', got ' + meson_python_version + ' instead')
endif
endif

endif

# Adapted from scipy, each project seems to have its own tweaks for this. One
Expand Down