summaryrefslogtreecommitdiff
path: root/test cases/unit/35 dist script/subprojects/sub/dist-script.py
blob: 5166a26f54d0738ff682663467e434e85853dd3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env python3

import os
import pathlib
import shlex
import subprocess
import sys

assert sys.argv[1] == 'success'

source_root = pathlib.Path(os.environ['MESON_PROJECT_DIST_ROOT'])
mesonrewrite = shlex.split(os.environ['MESONREWRITE'])
rewrite_cmd = ['kwargs', 'set', 'project', '/', 'version', 'release']

subprocess.run([*mesonrewrite, '-s', str(source_root.absolute()), *rewrite_cmd], check=True)

modfile = source_root / 'prog.c'
with modfile.open('w') as f:
    f.write('int main(){return 0;}')