Aluode/PerceptionLabPortable
0
1# utils is cimported from other subpackages so this is needed for the cimport
2# to work
3utils_cython_tree = [
4 # We add sklearn_root_cython_tree to make sure sklearn/__init__.py is copied
5 # early in the build
6 sklearn_root_cython_tree,
7 fs.copyfile('__init__.py'),
8 fs.copyfile('_cython_blas.pxd'),
9 fs.copyfile('_heap.pxd'),
10 fs.copyfile('_openmp_helpers.pxd'),
11 fs.copyfile('_random.pxd'),
12 fs.copyfile('_sorting.pxd'),
13 fs.copyfile('_typedefs.pxd'),
14 fs.copyfile('_vector_sentinel.pxd'),
15]
16
17utils_extension_metadata = {
18 'sparsefuncs_fast':
19 {'sources': [cython_gen.process('sparsefuncs_fast.pyx')]},
20 '_cython_blas': {'sources': [cython_gen.process('_cython_blas.pyx')]},
21 'arrayfuncs': {'sources': [cython_gen.process('arrayfuncs.pyx')]},
22 'murmurhash': {
23 'sources': [cython_gen.process('murmurhash.pyx'), 'src' / 'MurmurHash3.cpp'],
24 },
25 '_fast_dict':
26 {'sources': [cython_gen_cpp.process('_fast_dict.pyx')]},
27 '_openmp_helpers': {'sources': [cython_gen.process('_openmp_helpers.pyx')], 'dependencies': [openmp_dep]},
28 '_random': {'sources': [cython_gen.process('_random.pyx')]},
29 '_typedefs': {'sources': [cython_gen.process('_typedefs.pyx')]},
30 '_heap': {'sources': [cython_gen.process('_heap.pyx')]},
31 '_sorting': {'sources': [cython_gen.process('_sorting.pyx')]},
32 '_vector_sentinel':
33 {'sources': [cython_gen_cpp.process('_vector_sentinel.pyx')],
34 'dependencies': [np_dep]},
35 '_isfinite': {'sources': [cython_gen.process('_isfinite.pyx')]},
36}
37
38foreach ext_name, ext_dict : utils_extension_metadata
39 py.extension_module(
40 ext_name,
41 [ext_dict.get('sources'), utils_cython_tree],
42 dependencies: ext_dict.get('dependencies', []),
43 subdir: 'sklearn/utils',
44 install: true
45 )
46endforeach
47
48util_extension_names = ['_seq_dataset', '_weight_vector']
49
50foreach name: util_extension_names
51 pxd = custom_target(
52 name + '_pxd',
53 output: name + '.pxd',
54 input: name + '.pxd.tp',
55 command: [tempita, '@INPUT@', '-o', '@OUTDIR@'],
56 )
57 utils_cython_tree += [pxd]
58
59 pyx = custom_target(
60 name + '_pyx',
61 output: name + '.pyx',
62 input: name + '.pyx.tp',
63 command: [tempita, '@INPUT@', '-o', '@OUTDIR@'],
64 # TODO in principle this should go in py.exension_module below. This is
65 # temporary work-around for dependency issue with .pyx.tp files. For more
66 # details, see https://github.com/mesonbuild/meson/issues/13212
67 depends: [pxd, utils_cython_tree],
68 )
69 py.extension_module(
70 name,
71 cython_gen.process(pyx),
72 subdir: 'sklearn/utils',
73 install: true
74 )
75endforeach
76 