8000 BLD Reduce generated build file path lengths to avoid Windows path le… · scikit-learn/scikit-learn@c26fa16 · GitHub
[go: up one dir, main page]

Skip to content

Commit c26fa16

Browse files
authored
BLD Reduce generated build file path lengths to avoid Windows path length limitation (#31212)
1 parent 37a69e8 commit c26fa16

File tree

20 files changed

+77
-112
lines changed

20 files changed

+77
-112
lines changed

sklearn/__check_build/meson.build

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
py.extension_module(
22
'_check_build',
3-
'_check_build.pyx',
4-
cython_args: cython_args,
3+
cython_gen.process('_check_build.pyx'),
54
install: true,
65
subdir: 'sklearn/__check_build',
76
)

sklearn/_loss/meson.build

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ _loss_pyx = custom_target(
1616

1717
py.extension_module(
1818
'_loss',
19-
_loss_pyx,
19+
cython_gen.process(_loss_pyx),
2020
dependencies: [openmp_dep],
21-
cython_args: cython_args,
2221
install: true,
2322
subdir: 'sklearn/_loss',
2423
)

sklearn/cluster/_hdbscan/meson.build

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cluster_hdbscan_extension_metadata = {
2-
'_linkage': {'sources': ['_linkage.pyx', metrics_cython_tree]},
3-
'_reachability': {'sources': ['_reachability.pyx']},
2+
'_linkage': {'sources': [cython_gen.process('_linkage.pyx'), metrics_cython_tree]},
3+
'_reachability': {'sources': [cython_gen.process('_reachability.pyx')]},
44
'_tree': {'sources': ['_tree.pyx']}
55
}
66

@@ -9,7 +9,6 @@ foreach ext_name, ext_dict : cluster_hdbscan_extension_metadata
99
ext_name,
1010
ext_dict.get('sources'),
1111
dependencies: [np_dep],
12-
cython_args: cython_args,
1312
subdir: 'sklearn/cluster/_hdbscan',
1413
install: true
1514
)

sklearn/cluster/meson.build

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,23 @@
11
cluster_extension_metadata = {
22
'_dbscan_inner':
3-
{'sources': ['_dbscan_inner.pyx'], 'override_options': ['cython_language=cpp']},
3+
{'sources': [cython_gen_cpp.process('_dbscan_inner.pyx')]},
44
'_hierarchical_fast':
5-
{'sources': ['_hierarchical_fast.pyx', metrics_cython_tree],
6-
'override_options': ['cython_language=cpp']},
5+
{'sources': [cython_gen_cpp.process('_hierarchical_fast.pyx'), metrics_cython_tree]},
76
'_k_means_common':
8-
{'sources': ['_k_means_common.pyx'], 'dependencies': [openmp_dep]},
7+
{'sources': [cython_gen.process('_k_means_common.pyx')], 'dependencies': [openmp_dep]},
98
'_k_means_lloyd':
10-
{'sources': ['_k_means_lloyd.pyx'], 'dependencies': [openmp_dep]},
9+
{'sources': [cython_gen.process('_k_means_lloyd.pyx')], 'dependencies': [openmp_dep]},
1110
'_k_means_elkan':
12-
{'sources': ['_k_means_elkan.pyx'], 'dependencies': [openmp_dep]},
11+
{'sources': [cython_gen.process('_k_means_elkan.pyx')], 'dependencies': [openmp_dep]},
1312
'_k_means_minibatch':
14-
{'sources': ['_k_means_minibatch.pyx'], 'dependencies': [openmp_dep]},
13+
{'sources': [cython_gen.process('_k_means_minibatch.pyx')], 'dependencies': [openmp_dep]},
1514
}
1615

1716
foreach ext_name, ext_dict : cluster_extension_metadata
1817
py.extension_module(
1918
ext_name,
2019
[ext_dict.get('sources'), utils_cython_tree],
2120
dependencies: [np_dep] + ext_dict.get('dependencies', []),
22-
override_options : ext_dict.get('override_options', []),
23-
cython_args: cython_args,
2421
subdir: 'sklearn/cluster',
2522
install: true
2623
)

sklearn/datasets/meson.build

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
py.extension_module(
22
'_svmlight_format_fast',
3-
'_svmlight_format_fast.pyx',
3+
cython_gen.process('_svmlight_format_fast.pyx'),
44
dependencies: [np_dep],
5-
cython_args: cython_args,
65
subdir: 'sklearn/datasets',
76
install: true
87
)

sklearn/decomposition/meson.build

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
py.extension_module(
22
'_online_lda_fast',
3-
['_online_lda_fast.pyx', utils_cython_tree],
4-
cython_args: cython_args,
3+
[cython_gen.process('_online_lda_fast.pyx'), utils_cython_tree],
54
subdir: 'sklearn/decomposition',
65
install: true
76
)
87

98
py.extension_module(
109
'_cdnmf_fast',
11-
'_cdnmf_fast.pyx',
10+
cython_gen.process('_cdnmf_fast.pyx'),
1211
dependencies: [np_dep],
13-
cython_args: cython_args,
1412
subdir: 'sklearn/decomposition',
1513
install: true
1614
)

sklearn/ensemble/_hist_gradient_boosting/meson.build

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
hist_gradient_boosting_extension_metadata = {
2-
'_gradient_boosting': {'sources': ['_gradient_boosting.pyx'], 'dependencies': [openmp_dep]},
3-
'histogram': {'sources': ['histogram.pyx'], 'dependencies': [openmp_dep]},
4-
'splitting': {'sources': ['splitting.pyx'], 'dependencies': [openmp_dep]},
5-
'_binning': {'sources': ['_binning.pyx'], 'dependencies': [openmp_dep]},
6-
'_predictor': {'sources': ['_predictor.pyx'], 'dependencies': [openmp_dep]},
7-
'_bitset': {'sources': ['_bitset.pyx']},
8-
'common': {'sources': ['common.pyx']},
2+
'_gradient_boosting': {'sources': [cython_gen.process('_gradient_boosting.pyx')],
3+
'dependencies': [openmp_dep]},
4+
'histogram': {'sources': [cython_gen.process('histogram.pyx')], 'dependencies': [openmp_dep]},
5+
'splitting': {'sources': [cython_gen.process('splitting.pyx')], 'dependencies': [openmp_dep]},
6+
'_binning': {'sources': [cython_gen.process('_binning.pyx')], 'dependencies': [openmp_dep]},
7+
'_predictor': {'sources': [cython_gen.process('_predictor.pyx')], 'dependencies': [openmp_dep]},
8+
'_bitset': {'sources': [cython_gen.process('_bitset.pyx')]},
9+
'common': {'sources': [cython_gen.process('common.pyx')]},
910
}
1011

1112
foreach ext_name, ext_dict : hist_gradient_boosting_extension_metadata
1213
py.extension_module(
1314
ext_name,
1415
ext_dict.get('sources'),
1516
dependencies: ext_dict.get('dependencies', []),
16-
cython_args: cython_args,
1717
subdir: 'sklearn/ensemble/_hist_gradient_boosting',
1818
install: true
1919
)

sklearn/ensemble/meson.build

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
py.extension_module(
22
'_gradient_boosting',
3-
['_gradient_boosting.pyx'] + utils_cython_tree,
3+
[cython_gen.process('_gradient_boosting.pyx')] + utils_cython_tree,
44
dependencies: [np_dep],
5-
cython_args: cython_args,
65
subdir: 'sklearn/ensemble',
76
install: true
87
)
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
py.extension_module(
22
'_hashing_fast',
3-
['_hashing_fast.pyx', utils_cython_tree],
3+
[cython_gen_cpp.process('_hashing_fast.pyx'), utils_cython_tree],
44
dependencies: [np_dep],
5-
override_options: ['cython_language=cpp'],
6-
cython_args: cython_args,
75
subdir: 'sklearn/feature_extraction',
86
install: true
97
)

sklearn/linear_model/meson.build

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ linear_model_cython_tree = [
55

66
py.extension_module(
77
'_cd_fast',
8-
['_cd_fast.pyx', utils_cython_tree],
9-
cython_args: cython_args,
8+
[cython_gen.process('_cd_fast.pyx'), utils_cython_tree],
109
subdir: 'sklearn/linear_model',
1110
install: true
1211
)
@@ -26,8 +25,7 @@ foreach name: name_list
2625
)
2726
py.extension_module(
2827
name,
29-
pyx,
30-
cython_args: cython_args,
28+
cython_gen.process(pyx),
3129
subdir: 'sklearn/linear_model',
3230
install: true
3331
)

sklearn/manifold/meson.build

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
py.extension_module(
22
'_utils',
3-
['_utils.pyx', utils_cython_tree],
4-
cython_args: cython_args,
3+
[cython_gen.process('_utils.pyx'), utils_cython_tree],
54
subdir: 'sklearn/manifold',
65
install: true
76
)
87

98
py.extension_module(
109
'_barnes_hut_tsne',
11-
'_barnes_hut_tsne.pyx',
10+
cython_gen.process('_barnes_hut_tsne.pyx'),
1211
dependencies: [np_dep, openmp_dep],
13-
cython_args: cython_args,
1412
subdir: 'sklearn/manifold',
1513
install: true
1614
)

sklearn/meson.build

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,19 @@ scikit_learn_cython_args = [
190190
]
191191
cython_args += scikit_learn_cython_args
192192

193+
cython_program = find_program(cython.cmd_array()[0])
194+
195+
cython_gen = generator(cython_program,
196+
arguments : cython_args + ['@INPUT@', '--output-file', '@OUTPUT@'],
197+
output : '@BASENAME@.c',
198+
)
199+
200+
cython_gen_cpp = generator(cython_program,
201+
arguments : cython_args + ['--cplus', '@INPUT@', '--output-file', '@OUTPUT@'],
202+
output : '@BASENAME@.cpp',
203+
)
204+
205+
193206
# Write file in Meson build dir to be able to figure out from Python code
194207
# whether scikit-learn was built with Meson. Adapted from pandas
195208
# _version_meson.py.

sklearn/metrics/_pairwise_distances_reduction/meson.build

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,8 @@ _datasets_pair_pyx = custom_target(
3838
)
3939
_datasets_pair = py.extension_module(
4040
'_datasets_pair',
41-
_datasets_pair_pyx,
41+
cython_gen_cpp.process(_datasets_pair_pyx),
4242
dependencies: [np_dep],
43-
override_options: ['cython_language=cpp'],
44-
cython_args: cython_args,
4543
subdir: 'sklearn/metrics/_pairwise_distances_reduction',
4644
install: true
4745
)
@@ -65,10 +63,8 @@ _base_pyx = custom_target(
6563
)
6664
_base = py.extension_module(
6765
'_base',
68-
_base_pyx,
66+
cython_gen_cpp.process(_base_pyx),
6967
dependencies: [np_dep, openmp_dep],
70-
override_options: ['cython_language=cpp'],
71-
cython_args: cython_args,
7268
subdir: 'sklearn/metrics/_pairwise_distances_reduction',
7369
install: true
7470
)
@@ -93,10 +89,8 @@ _middle_term_computer_pyx = custom_target(
9389
)
9490
_middle_term_computer = py.extension_module(
9591
'_middle_term_computer',
96-
_middle_term_computer_pyx,
92+
cython_gen_cpp.process(_middle_term_computer_pyx),
9793
dependencies: [np_dep],
98-
override_options: ['cython_language=cpp'],
99-
cython_args: cython_args,
10094
subdir: 'sklearn/metrics/_pairwise_distances_reduction',
10195
install: true
10296
)
@@ -121,10 +115,8 @@ _argkmin_pyx = custom_target(
121115
)
122116
_argkmin = py.extension_module(
123117
'_argkmin',
124-
_argkmin_pyx,
118+
cython_gen_cpp.process(_argkmin_pyx),
125119
dependencies: [np_dep, openmp_dep],
126-
override_options: ['cython_language=cpp'],
127-
cython_args: cython_args,
128120
subdir: 'sklearn/metrics/_pairwise_distances_reduction',
129121
install: true
130122
)
@@ -149,10 +141,8 @@ _radius_neighbors_pyx = custom_target(
149141
)
150142
_radius_neighbors = py.extension_module(
151143
'_radius_neighbors',
152-
_radius_neighbors_pyx,
144+
cython_gen_cpp.process(_radius_neighbors_pyx),
153145
dependencies: [np_dep, openmp_dep],
154-
override_options: ['cython_language=cpp'],
155-
cython_args: cython_args,
156146
subdir: 'sklearn/metrics/_pairwise_distances_reduction',
157147
install: true
158148
)
@@ -171,10 +161,8 @@ _argkmin_classmode_pyx = custom_target(
171161
)
172162
_argkmin_classmode = py.extension_module(
173163
'_argkmin_classmode',
174-
_argkmin_classmode_pyx,
164+
cython_gen_cpp.process(_argkmin_classmode_pyx),
175165
dependencies: [np_dep, openmp_dep],
176-
override_options: ['cython_language=cpp'],
177-
cython_args: cython_args,
178166
# XXX: for some reason -fno-sized-deallocation is needed otherwise there is
179167
# an error with undefined symbol _ZdlPv at import time in manylinux wheels.
180168
# See https://github.com/scikit-learn/scikit-learn/issues/28596 for more details.
@@ -198,10 +186,8 @@ _radius_neighbors_classmode_pyx = custom_target(
198186
)
199187
_radius_neighbors_classmode = py.extension_module(
200188
'_radius_neighbors_classmode',
201-
_radius_neighbors_classmode_pyx,
189+
cython_gen_cpp.process(_radius_neighbors_classmode_pyx),
202190
dependencies: [np_dep, openmp_dep],
203-
override_options: ['cython_language=cpp'],
204-
cython_args: cython_args,
205191
subdir: 'sklearn/metrics/_pairwise_distances_reduction',
206192
install: true
207193
)

sklearn/metrics/cluster/meson.build

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
py.extension_module(
22
'_expected_mutual_info_fast',
3-
'_expected_mutual_info_fast.pyx',
4-
cython_args: cython_args,
3+
cython_gen.process('_expected_mutual_info_fast.pyx'),
54
subdir: 'sklearn/metrics/cluster',
65
install: true
76
)

sklearn/metrics/meson.build

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,16 @@ _dist_metrics_pyx = custom_target(
3131

3232
_dist_metrics = py.extension_module(
3333
'_dist_metrics',
34-
_dist_metrics_pyx,
34+
cython_gen.process(_dist_metrics_pyx),
3535
dependencies: [np_dep],
36-
cython_args: cython_args,
3736
subdir: 'sklearn/metrics',
3837
install: true
3938
)
4039

4140
py.extension_module(
4241
'_pairwise_fast',
43-
['_pairwise_fast.pyx', metrics_cython_tree],
42+
[cython_gen.process('_pairwise_fast.pyx'), metrics_cython_tree],
4443
dependencies: [openmp_dep],
45-
cython_args: cython_args,
4644
subdir: 'sklearn/metrics',
4745
install: true
4846
)

sklearn/neighbors/meson.build

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,17 @@ foreach name: name_list
2828
)
2929
py.extension_module(
3030
name,
31-
pyx,
31+
cython_gen.process(pyx),
3232
dependencies: [np_dep],
33-
cython_args: cython_args,
3433
subdir: 'sklearn/neighbors',
3534
install: true
3635
)
3736
endforeach
3837

3938
neighbors_extension_metadata = {
4039
'_partition_nodes':
41-
{'sources': ['_partition_nodes.pyx'],
42-
'override_options': ['cython_language=cpp'], 'dependencies': [np_dep]},
40+
{'sources': [cython_gen_cpp.process('_partition_nodes.pyx')],
41+
'dependencies': [np_dep]},
4342
'_quad_tree': {'sources': ['_quad_tree.pyx' 97AE ;], 'dependencies': [np_dep]},
4443
}
4544

@@ -48,8 +47,6 @@ foreach ext_name, ext_dict : neighbors_extension_metadata
4847
ext_name,
4948
[ext_dict.get('sources'), utils_cython_tree],
5049
dependencies: ext_dict.get('dependencies'),
51-
override_options : ext_dict.get('override_options', []),
52-
cython_args: cython_args,
5350
subdir: 'sklearn/neighbors',
5451
install: true
5552
)

sklearn/preprocessing/meson.build

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
py.extension_module(
22
'_csr_polynomial_expansion',
3-
['_csr_polynomial_expansion.pyx', utils_cython_tree],
4-
cython_args: cython_args,
3+
[cython_gen.process('_csr_polynomial_expansion.pyx'), utils_cython_tree],
54
subdir: 'sklearn/preprocessing',
65
install: true
76
)
87

98
py.extension_module(
109
'_target_encoder_fast',
11-
['_target_encoder_fast.pyx', utils_cython_tree],
12-
override_options: ['cython_language=cpp'],
13-
cython_args: cython_args,
10+
[cython_gen_cpp.process('_target_encoder_fast.pyx'), utils_cython_tree],
1411
subdir: 'sklearn/preprocessing',
1512
install: true
1613
)

0 commit comments

Comments
 (0)
0