File: use-as-subproject.py

package info (click to toggle)
dbus-python 1.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,708 kB
  • sloc: ansic: 9,653; python: 4,664; makefile: 597; sh: 428
file content (34 lines) | stat: -rw-r--r-- 987 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/env python3
# Copyright 2022 Collabora Ltd.
# SPDX-License-Identifier: MIT

import os
import shutil
import subprocess
import tempfile

HERE = os.path.dirname(os.path.abspath(__file__))

if __name__ == '__main__':
    if shutil.which('meson') is None:
        print('SKIP: meson not found in PATH')
        raise SystemExit(0)

    with tempfile.TemporaryDirectory() as temp:
        shutil.copytree(
            os.path.join(HERE, 'use-as-subproject'),
            os.path.join(temp, 'src'),
        )
        os.makedirs(os.path.join(temp, 'src', 'subprojects'), exist_ok=True)
        os.symlink(
            os.path.dirname(HERE),
            os.path.join(temp, 'src', 'subprojects', 'dbus-gmain'),
        )
        subprocess.run(
            ['meson', os.path.join(temp, 'src'), os.path.join(temp, 'build')],
            check=True,
        )
        subprocess.run(
            ['meson', 'compile', '-C', os.path.join(temp, 'build')],
            check=True,
        )