Skip to content

Commit d301304

Browse files
authored
BLD Use work-around for partial recompilation when building with Meson (scikit-learn#29140)
1 parent bc7e52a commit d301304

File tree

6 files changed

+78
-32
lines changed

6 files changed

+78
-32
lines changed

sklearn/_loss/meson.build

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,15 @@ _loss_pyx = custom_target(
88
output: '_loss.pyx',
99
input: '_loss.pyx.tp',
1010
command: [py, tempita, '@INPUT@', '-o', '@OUTDIR@'],
11+
# TODO in principle this should go in py.exension_module below. This is
12+
# temporary work-around for dependency issue with .pyx.tp files. For more
13+
# details, see https://github.com/mesonbuild/meson/issues/13212
14+
depends: _loss_cython_tree,
1115
)
1216

1317
py.extension_module(
1418
'_loss',
15-
[_loss_pyx, _loss_cython_tree],
19+
_loss_pyx,
1620
cython_args: cython_args,
1721
install: true,
1822
subdir: 'sklearn/_loss',

sklearn/linear_model/meson.build

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,15 @@ foreach name: name_list
1919
name + '_pyx',
2020
output: name + '.pyx',
2121
input: name + '.pyx.tp',
22-
command: [py, tempita, '@INPUT@', '-o', '@OUTDIR@']
22+
command: [py, tempita, '@INPUT@', '-o', '@OUTDIR@'],
23+
# TODO in principle this should go in py.exension_module below. This is
24+
# temporary work-around for dependency issue with .pyx.tp files. For more
25+
# details, see https://github.com/mesonbuild/meson/issues/13212
26+
depends: [linear_model_cython_tree, utils_cython_tree],
2327
)
2428
py.extension_module(
2529
name,
26-
[pyx, linear_model_cython_tree, utils_cython_tree],
30+
pyx,
2731
cython_args: cython_args,
2832
subdir: 'sklearn/linear_model',
2933
install: true

sklearn/metrics/_pairwise_distances_reduction/meson.build

Lines changed: 49 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,14 @@ _datasets_pair_pyx = custom_target(
3131
output: '_datasets_pair.pyx',
3232
input: '_datasets_pair.pyx.tp',
3333
command: [py, tempita, '@INPUT@', '-o', '@OUTDIR@'],
34+
# TODO in principle this should go in py.exension_module below. This is
35+
# temporary work-around for dependency issue with .pyx.tp files. For more
36+
# details, see https://github.com/mesonbuild/meson/issues/13212
37+
depends: [_datasets_pair_pxd, _pairwise_distances_reduction_cython_tree, utils_cython_tree],
3438
)
3539
_datasets_pair = py.extension_module(
3640
'_datasets_pair',
37-
[_datasets_pair_pxd, _datasets_pair_pyx,
38-
_pairwise_distances_reduction_cython_tree, utils_cython_tree],
41+
_datasets_pair_pyx,
3942
dependencies: [np_dep, openmp_dep],
4043
override_options: ['cython_language=cpp'],
4144
cython_args: cython_args,
@@ -54,12 +57,15 @@ _base_pyx = custom_target(
5457
output: '_base.pyx',
5558
input: '_base.pyx.tp',
5659
command: [py, tempita, '@INPUT@', '-o', '@OUTDIR@'],
60+
# TODO in principle this should go in py.exension_module below. This is
61+
# temporary work-around for dependency issue with .pyx.tp files. For more
62+
# details, see https://github.com/mesonbuild/meson/issues/13212
63+
depends: [_base_pxd, _pairwise_distances_reduction_cython_tree,
64+
_datasets_pair_pxd, utils_cython_tree],
5765
)
5866
_base = py.extension_module(
5967
'_base',
60-
[_base_pxd, _base_pyx,
61-
_pairwise_distances_reduction_cython_tree,
62-
_datasets_pair_pxd, utils_cython_tree],
68+
_base_pyx,
6369
dependencies: [np_dep, openmp_dep],
6470
override_options: ['cython_language=cpp'],
6571
cython_args: cython_args,
@@ -78,11 +84,16 @@ _middle_term_computer_pyx = custom_target(
7884
output: '_middle_term_computer.pyx',
7985
input: '_middle_term_computer.pyx.tp',
8086
command: [py, tempita, '@INPUT@', '-o', '@OUTDIR@'],
87+
# TODO in principle this should go in py.exension_module below. This is
88+
# temporary work-around for dependency issue with .pyx.tp files. For more
89+
# details, see https://github.com/mesonbuild/meson/issues/13212
90+
depends: [_middle_term_computer_pxd,
91+
_pairwise_distances_reduction_cython_tree,
92+
utils_cython_tree],
8193
)
8294
_middle_term_computer = py.extension_module(
8395
'_middle_term_computer',
84-
[_middle_term_computer_pxd, _middle_term_computer_pyx,
85-
_pairwise_distances_reduction_cython_tree, utils_cython_tree],
96+
_middle_term_computer_pyx,
8697
dependencies: [np_dep, openmp_dep],
8798
override_options: ['cython_language=cpp'],
8899
cython_args: cython_args,
@@ -101,13 +112,16 @@ _argkmin_pyx = custom_target(
101112
output: '_argkmin.pyx',
102113
input: '_argkmin.pyx.tp',
103114
command: [py, tempita, '@INPUT@', '-o', '@OUTDIR@'],
104-
)
115+
# TODO in principle this should go in py.exension_module below. This is
116+
# temporary work-around for dependency issue with .pyx.tp files. For more
117+
# details, see https://github.com/mesonbuild/meson/issues/13212
118+
depends: [_argkmin_pxd,
119+
_pairwise_distances_reduction_cython_tree,
120+
_datasets_pair_pxd, _base_pxd, _middle_term_computer_pxd],
121+
)
105122
_argkmin = py.extension_module(
106123
'_argkmin',
107-
[_argkmin_pxd, _argkmin_pyx,
108-
_pairwise_distances_reduction_cython_tree,
109-
_datasets_pair_pxd, _base_pxd, _middle_term_computer_pxd,
110-
utils_cython_tree],
124+
_argkmin_pyx,
111125
dependencies: [np_dep, openmp_dep],
112126
override_options: ['cython_language=cpp'],
113127
cython_args: cython_args,
@@ -126,12 +140,16 @@ _radius_neighbors_pyx = custom_target(
126140
output: '_radius_neighbors.pyx',
127141
input: '_radius_neighbors.pyx.tp',
128142
command: [py, tempita, '@INPUT@', '-o', '@OUTDIR@'],
129-
)
143+
# TODO in principle this should go in py.exension_module below. This is
144+
# temporary work-around for dependency issue with .pyx.tp files. For more
145+
# details, see https://github.com/mesonbuild/meson/issues/13212
146+
depends: [_radius_neighbors_pxd,
147+
_datasets_pair_pxd, _base_pxd, _middle_term_computer_pxd,
148+
_pairwise_distances_reduction_cython_tree, utils_cython_tree],
149+
)
130150
_radius_neighbors = py.extension_module(
131151
'_radius_neighbors',
132-
[_radius_neighbors_pxd, _radius_neighbors_pyx,
133-
_datasets_pair_pxd, _base_pxd, _middle_term_computer_pxd,
134-
_pairwise_distances_reduction_cython_tree, utils_cython_tree],
152+
_radius_neighbors_pyx,
135153
dependencies: [np_dep, openmp_dep],
136154
override_options: ['cython_language=cpp'],
137155
cython_args: cython_args,
@@ -144,12 +162,16 @@ _argkmin_classmode_pyx = custom_target(
144162
output: '_argkmin_classmode.pyx',
145163
input: '_argkmin_classmode.pyx.tp',
146164
command: [py, tempita, '@INPUT@', '-o', '@OUTDIR@'],
165+
# TODO in principle this should go in py.exension_module below. This is
166+
# temporary work-around for dependency issue with .pyx.tp files. For more
167+
# details, see https://github.com/mesonbuild/meson/issues/13212
168+
depends: [_classmode_pxd,
169+
_argkmin_pxd, _pairwise_distances_reduction_cython_tree,
170+
_datasets_pair_pxd, _base_pxd, _middle_term_computer_pxd, utils_cython_tree],
147171
)
148172
_argkmin_classmode = py.extension_module(
149173
'_argkmin_classmode',
150-
[_argkmin_classmode_pyx, _classmode_pxd,
151-
_argkmin_pxd, _pairwise_distances_reduction_cython_tree,
152-
_datasets_pair_pxd, _base_pxd, _middle_term_computer_pxd, utils_cython_tree],
174+
_argkmin_classmode_pyx,
153175
dependencies: [np_dep],
154176
override_options: ['cython_language=cpp'],
155177
cython_args: cython_args,
@@ -166,13 +188,17 @@ _radius_neighbors_classmode_pyx = custom_target(
166188
output: '_radius_neighbors_classmode.pyx',
167189
input: '_radius_neighbors_classmode.pyx.tp',
168190
command: [py, tempita, '@INPUT@', '-o', '@OUTDIR@'],
191+
# TODO in principle this should go in py.exension_module below. This is
192+
# temporary work-around for dependency issue with .pyx.tp files. For more
193+
# details, see https://github.com/mesonbuild/meson/issues/13212
194+
depends: [_classmode_pxd,
195+
_middle_term_computer_pxd, _radius_neighbors_pxd,
196+
_pairwise_distances_reduction_cython_tree,
197+
_datasets_pair_pxd, _base_pxd, utils_cython_tree],
169198
)
170199
_radius_neighbors_classmode = py.extension_module(
171200
'_radius_neighbors_classmode',
172-
[_radius_neighbors_classmode_pyx, _classmode_pxd,
173-
_middle_term_computer_pxd, _radius_neighbors_pxd,
174-
_pairwise_distances_reduction_cython_tree,
175-
_datasets_pair_pxd, _base_pxd, utils_cython_tree],
201+
_radius_neighbors_classmode_pyx,
176202
dependencies: [np_dep],
177203
override_options: ['cython_language=cpp'],
178204
cython_args: cython_args,

sklearn/metrics/meson.build

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,16 @@ _dist_metrics_pyx = custom_target(
2222
'_dist_metrics_pyx',
2323
output: '_dist_metrics.pyx',
2424
input: '_dist_metrics.pyx.tp',
25-
command: [py, tempita, '@INPUT@', '-o', '@OUTDIR@']
25+
command: [py, tempita, '@INPUT@', '-o', '@OUTDIR@'],
26+
# TODO in principle this should go in py.exension_module below. This is
27+
# temporary work-around for dependency issue with .pyx.tp files. For more
28+
# details, see https://github.com/mesonbuild/meson/issues/13212
29+
depends: metrics_cython_tree,
2630
)
2731

2832
_dist_metrics = py.extension_module(
2933
'_dist_metrics',
30-
[_dist_metrics_pyx, metrics_cython_tree],
34+
_dist_metrics_pyx,
3135
dependencies: [np_dep],
3236
cython_args: cython_args,
3337
subdir: 'sklearn/metrics',

sklearn/neighbors/meson.build

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,15 @@ foreach name: name_list
2020
name + '_pyx',
2121
output: name + '.pyx',
2222
input: name + '.pyx.tp',
23-
command: [py, tempita, '@INPUT@', '-o', '@OUTDIR@']
23+
command: [py, tempita, '@INPUT@', '-o', '@OUTDIR@'],
24+
# TODO in principle this should go in py.exension_module below. This is
25+
# temporary work-around for dependency issue with .pyx.tp files. For more
26+
# details, see https://github.com/mesonbuild/meson/issues/13212
27+
depends: [neighbors_cython_tree, utils_cython_tree, metrics_cython_tree],
2428
)
2529
py.extension_module(
2630
name,
27-
[pyx, neighbors_cython_tree, utils_cython_tree, metrics_cython_tree],
31+
pyx,
2832
dependencies: [np_dep],
2933
cython_args: cython_args,
3034
subdir: 'sklearn/neighbors',

sklearn/utils/meson.build

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,15 @@ foreach name: util_extension_names
6262
name + '_pyx',
6363
output: name + '.pyx',
6464
input: name + '.pyx.tp',
65-
command: [py, tempita, '@INPUT@', '-o', '@OUTDIR@']
65+
command: [py, tempita, '@INPUT@', '-o', '@OUTDIR@'],
66+
# TODO in principle this should go in py.exension_module below. This is
67+
# temporary work-around for dependency issue with .pyx.tp files. For more
68+
# details, see https://github.com/mesonbuild/meson/issues/13212
69+
depends: [pxd, utils_cython_tree],
6670
)
6771
py.extension_module(
6872
name,
69-
[pxd, pyx, utils_cython_tree],
73+
pyx,
7074
cython_args: cython_args,
7175
subdir: 'sklearn/utils',
7276
install: true

0 commit comments

Comments
 (0)