summaryrefslogtreecommitdiffstats
path: root/meta/classes-recipe/python_mesonpy.bbclass
blob: 131fa74bede9f3753997793326594c2b210e11c5 (plain)
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
52
#
# Copyright OpenEmbedded Contributors
#
# SPDX-License-Identifier: MIT
#

inherit meson setuptools3-base python3targetconfig python_pep517

# meson_do_qa_configure does the wrong thing here because
# mesonpy runs "meson setup ..." in do_compile context.
# Make it a dummy function.
meson_do_qa_configure () {
    :
}

# This prevents the meson error:
# ERROR: Got argument buildtype as both -Dbuildtype and --buildtype. Pick one.
MESONOPTS:remove = "--buildtype ${MESON_BUILDTYPE}"

CONFIGURE_FILES = "pyproject.toml"

DEPENDS += "python3-wheel-native python3-meson-python-native"

def mesonpy_get_args(d):
    vars = ['MESONOPTS', 'MESON_CROSS_FILE', 'EXTRA_OEMESON']
    varlist = []
    for var in vars:
        value = d.getVar(var)
        vallist = value.split()
        for elem in vallist:
            varlist.append("-Csetup-args=" + elem)
    return ' '.join(varlist)

PEP517_BUILD_OPTS = "-Cbuilddir='${B}' ${@mesonpy_get_args(d)}"

# Python pyx -> c -> so build leaves absolute build paths in the code
INSANE_SKIP:${PN} += "buildpaths"
INSANE_SKIP:${PN}-src += "buildpaths"

python_mesonpy_do_configure () {
    python_pep517_do_configure
}

python_mesonpy_do_compile () {
    python_pep517_do_compile
}

python_mesonpy_do_install () {
    python_pep517_do_install
}

EXPORT_FUNCTIONS do_configure do_compile do_install