Skip to content

BLD Remove build_utils/ from the built wheels, and associated Meson cleanups #29821

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

Closed
Show file tree
Hide file tree
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
10 changes: 7 additions & 3 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,16 @@ if m_dep.found()
add_project_link_arguments('-lm', language : 'c')
endif

tempita = files('sklearn/_build_utils/tempita.py')
tempita = find_program('sklearn/_build_utils/tempita.py')

py = import('python').find_installation(pure: false)

# Copy all the .py files to the install dir, rather than using
# py.install_sources and needing to list them explicitely one by one
install_subdir('sklearn', install_dir: py.get_install_dir())
# py.install_sources and needing to list them explicitly one by one
# Exclude the _build_utils directory, which is not needed at runtime
install_subdir('sklearn',
install_dir: py.get_install_dir(),
exclude_directories: ['_build_utils']
)

subdir('sklearn')
2 changes: 2 additions & 0 deletions sklearn/_build_utils/tempita.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env python3

Comment on lines +1 to +2
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the reason why this shebang has been added, please refer to numpy/numpy#24971.

# Authors: The scikit-learn developers
# SPDX-License-Identifier: BSD-3-Clause

Expand Down
2 changes: 1 addition & 1 deletion sklearn/_loss/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ _loss_pyx = custom_target(
'_loss_pyx',
output: '_loss.pyx',
input: '_loss.pyx.tp',
command: [py, tempita, '@INPUT@', '-o', '@OUTDIR@'],
command: [tempita, '@INPUT@', '-o', '@OUTDIR@'],
# TODO in principle this should go in py.exension_module below. This is
# temporary work-around for dependency issue with .pyx.tp files. For more
# details, see https://github.com/mesonbuild/meson/issues/13212
Expand Down
2 changes: 1 addition & 1 deletion sklearn/linear_model/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ foreach name: name_list
name + '_pyx',
output: name + '.pyx',
input: name + '.pyx.tp',
command: [py, tempita, '@INPUT@', '-o', '@OUTDIR@'],
command: [tempita, '@INPUT@', '-o', '@OUTDIR@'],
# TODO in principle this should go in py.exension_module below. This is
# temporary work-around for dependency issue with .pyx.tp files. For more
# details, see https://github.com/mesonbuild/meson/issues/13212
Expand Down
24 changes: 12 additions & 12 deletions sklearn/metrics/_pairwise_distances_reduction/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ _datasets_pair_pxd = custom_target(
'_datasets_pair_pxd',
output: '_datasets_pair.pxd',
input: '_datasets_pair.pxd.tp',
command: [py, tempita, '@INPUT@', '-o', '@OUTDIR@']
command: [tempita, '@INPUT@', '-o', '@OUTDIR@']
)
_datasets_pair_pyx = custom_target(
'_datasets_pair_pyx',
output: '_datasets_pair.pyx',
input: '_datasets_pair.pyx.tp',
command: [py, tempita, '@INPUT@', '-o', '@OUTDIR@'],
command: [tempita, '@INPUT@', '-o', '@OUTDIR@'],
# TODO in principle this should go in py.exension_module below. This is
# temporary work-around for dependency issue with .pyx.tp files. For more
# details, see https://github.com/mesonbuild/meson/issues/13212
Expand All @@ -50,13 +50,13 @@ _base_pxd = custom_target(
'_base_pxd',
output: '_base.pxd',
input: '_base.pxd.tp',
command: [py, tempita, '@INPUT@', '-o', '@OUTDIR@']
command: [tempita, '@INPUT@', '-o', '@OUTDIR@']
)
_base_pyx = custom_target(
'_base_pyx',
output: '_base.pyx',
input: '_base.pyx.tp',
command: [py, tempita, '@INPUT@', '-o', '@OUTDIR@'],
command: [tempita, '@INPUT@', '-o', '@OUTDIR@'],
# TODO in principle this should go in py.exension_module below. This is
# temporary work-around for dependency issue with .pyx.tp files. For more
# details, see https://github.com/mesonbuild/meson/issues/13212
Expand All @@ -77,13 +77,13 @@ _middle_term_computer_pxd = custom_target(
'_middle_term_computer_pxd',
output: '_middle_term_computer.pxd',
input: '_middle_term_computer.pxd.tp',
command: [py, tempita, '@INPUT@', '-o', '@OUTDIR@']
command: [tempita, '@INPUT@', '-o', '@OUTDIR@']
)
_middle_term_computer_pyx = custom_target(
'_middle_term_computer_pyx',
output: '_middle_term_computer.pyx',
input: '_middle_term_computer.pyx.tp',
command: [py, tempita, '@INPUT@', '-o', '@OUTDIR@'],
command: [tempita, '@INPUT@', '-o', '@OUTDIR@'],
# TODO in principle this should go in py.exension_module below. This is
# temporary work-around for dependency issue with .pyx.tp files. For more
# details, see https://github.com/mesonbuild/meson/issues/13212
Expand All @@ -105,13 +105,13 @@ _argkmin_pxd = custom_target(
'_argkmin_pxd',
output: '_argkmin.pxd',
input: '_argkmin.pxd.tp',
command: [py, tempita, '@INPUT@', '-o', '@OUTDIR@']
command: [tempita, '@INPUT@', '-o', '@OUTDIR@']
)
_argkmin_pyx = custom_target(
'_argkmin_pyx',
output: '_argkmin.pyx',
input: '_argkmin.pyx.tp',
command: [py, tempita, '@INPUT@', '-o', '@OUTDIR@'],
command: [tempita, '@INPUT@', '-o', '@OUTDIR@'],
# TODO in principle this should go in py.exension_module below. This is
# temporary work-around for dependency issue with .pyx.tp files. For more
# details, see https://github.com/mesonbuild/meson/issues/13212
Expand All @@ -133,13 +133,13 @@ _radius_neighbors_pxd = custom_target(
'_radius_neighbors_pxd',
output: '_radius_neighbors.pxd',
input: '_radius_neighbors.pxd.tp',
command: [py, tempita, '@INPUT@', '-o', '@OUTDIR@']
command: [tempita, '@INPUT@', '-o', '@OUTDIR@']
)
_radius_neighbors_pyx = custom_target(
'_radius_neighbors_pyx',
output: '_radius_neighbors.pyx',
input: '_radius_neighbors.pyx.tp',
command: [py, tempita, '@INPUT@', '-o', '@OUTDIR@'],
command: [tempita, '@INPUT@', '-o', '@OUTDIR@'],
# TODO in principle this should go in py.exension_module below. This is
# temporary work-around for dependency issue with .pyx.tp files. For more
# details, see https://github.com/mesonbuild/meson/issues/13212
Expand All @@ -161,7 +161,7 @@ _argkmin_classmode_pyx = custom_target(
'_argkmin_classmode_pyx',
output: '_argkmin_classmode.pyx',
input: '_argkmin_classmode.pyx.tp',
command: [py, tempita, '@INPUT@', '-o', '@OUTDIR@'],
command: [tempita, '@INPUT@', '-o', '@OUTDIR@'],
# TODO in principle this should go in py.exension_module below. This is
# temporary work-around for dependency issue with .pyx.tp files. For more
# details, see https://github.com/mesonbuild/meson/issues/13212
Expand All @@ -187,7 +187,7 @@ _radius_neighbors_classmode_pyx = custom_target(
'_radius_neighbors_classmode_pyx',
output: '_radius_neighbors_classmode.pyx',
input: '_radius_neighbors_classmode.pyx.tp',
command: [py, tempita, '@INPUT@', '-o', '@OUTDIR@'],
command: [tempita, '@INPUT@', '-o', '@OUTDIR@'],
# TODO in principle this should go in py.exension_module below. This is
# temporary work-around for dependency issue with .pyx.tp files. For more
# details, see https://github.com/mesonbuild/meson/issues/13212
Expand Down
4 changes: 2 additions & 2 deletions sklearn/metrics/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ _dist_metrics_pxd = custom_target(
'_dist_metrics_pxd',
output: '_dist_metrics.pxd',
input: '_dist_metrics.pxd.tp',
command: [py, tempita, '@INPUT@', '-o', '@OUTDIR@'],
command: [tempita, '@INPUT@', '-o', '@OUTDIR@'],
# Need to install the generated pxd because it is needed in other subpackages
# Cython code, e.g. sklearn.cluster
install_dir: sklearn_dir / 'metrics',
Expand All @@ -22,7 +22,7 @@ _dist_metrics_pyx = custom_target(
'_dist_metrics_pyx',
output: '_dist_metrics.pyx',
input: '_dist_metrics.pyx.tp',
command: [py, tempita, '@INPUT@', '-o', '@OUTDIR@'],
command: [tempita, '@INPUT@', '-o', '@OUTDIR@'],
# TODO in principle this should go in py.exension_module below. This is
# temporary work-around for dependency issue with .pyx.tp files. For more
# details, see https://github.com/mesonbuild/meson/issues/13212
Expand Down
4 changes: 2 additions & 2 deletions sklearn/neighbors/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ _binary_tree_pxi = custom_target(
'_binary_tree_pxi',
output: '_binary_tree.pxi',
input: '_binary_tree.pxi.tp',
command: [py, tempita, '@INPUT@', '-o', '@OUTDIR@'],
command: [tempita, '@INPUT@', '-o', '@OUTDIR@'],
)

# .pyx is generated so this is needed to make Cython compilation work. The pxi
Expand All @@ -20,7 +20,7 @@ foreach name: name_list
name + '_pyx',
output: name + '.pyx',
input: name + '.pyx.tp',
command: [py, tempita, '@INPUT@', '-o', '@OUTDIR@'],
command: [tempita, '@INPUT@', '-o', '@OUTDIR@'],
# TODO in principle this should go in py.exension_module below. This is
# temporary work-around for dependency issue with .pyx.tp files. For more
# details, see https://github.com/mesonbuild/meson/issues/13212
Expand Down
4 changes: 2 additions & 2 deletions sklearn/utils/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ foreach name: util_extension_names
name + '_pxd',
output: name + '.pxd',
input: name + '.pxd.tp',
command: [py, tempita, '@INPUT@', '-o', '@OUTDIR@'],
command: [tempita, '@INPUT@', '-o', '@OUTDIR@'],
)
utils_cython_tree += [pxd]

pyx = custom_target(
name + '_pyx',
output: name + '.pyx',
input: name + '.pyx.tp',
command: [py, tempita, '@INPUT@', '-o', '@OUTDIR@'],
command: [tempita, '@INPUT@', '-o', '@OUTDIR@'],
# TODO in principle this should go in py.exension_module below. This is
# temporary work-around for dependency issue with .pyx.tp files. For more
# details, see https://github.com/mesonbuild/meson/issues/13212
Expand Down
Loading