File: meson.build

package info (click to toggle)
netplan.io 1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 4,268 kB
  • sloc: python: 34,640; ansic: 14,096; xml: 4,989; javascript: 2,165; sh: 513; makefile: 118
file content (51 lines) | stat: -rw-r--r-- 1,282 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
pymod = import('python')
python = pymod.find_installation(
    'python3',
    modules: ['cffi']
)
python_dep = python.dependency(required: true)

cffi_srcs = configure_file(
    command: [
        python,
        files('_build_cffi.py'),
        join_paths(meson.project_source_root(), 'include'),
        join_paths(meson.current_build_dir(), 'src'),
    ],
    output: '_netplan_cffi.c',
)

# Generation of the Python binary extension through meson.
cffi_pyext = python.extension_module(
    '_netplan_cffi',
    cffi_srcs,
    dependencies: [python_dep, glib, uuid],
    include_directories: [inc, inc_internal],
    link_with: [libnetplan],
    subdir: 'netplan',
    install: true,
    limited_api: '3.10',
)

bindings_sources = [
  '__init__.py',
  'netdef.py',
  'parser.py',
  'state.py',
  '_utils.py']

# Copy module sources into build-dir,
# so they can be importet together with the binary extension
foreach src : bindings_sources
    custom_target(
        input: src,
        output: src,
        command: ['cp', '@INPUT@', join_paths(meson.current_build_dir(), '@PLAINNAME@')],
        build_always_stale: true,
        build_by_default: true,
        depends: cffi_pyext)
endforeach

bindings = python.install_sources(
    [bindings_sources],
    subdir: 'netplan')