summaryrefslogtreecommitdiffstats
path: root/build.py
blob: 95e63e10edceee8d7780cfdee717ffa679d2f773 (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
import subprocess

from pathlib import Path


def meson(*args):
    subprocess.call(["meson"] + list(args))


def _build():
    build_dir = Path(__file__).parent.joinpath("build")
    build_dir.mkdir(parents=True, exist_ok=True)

    meson("setup", build_dir.as_posix())
    meson("compile", "-C", build_dir.as_posix())
    meson("install", "-C", build_dir.as_posix())


def build(setup_kwargs):
    """
    This function is mandatory in order to build the extensions.
    """
    try:
        _build()
    except Exception:
        print(
            "  Unable to build C extensions, "
            "Pendulum will use the pure python version of the extensions."
        )


if __name__ == "__main__":
    build({})