aboutsummaryrefslogtreecommitdiff
path: root/test cases/common/140 mesonintrospect from scripts/check_env.py
blob: 2d46d888fd00658eb2943ac122e2bb55de796bfc (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
#!/usr/bin/env python3

import os
import sys
import shlex

do_print = False

if len(sys.argv) > 1:
    do_print = bool(sys.argv[1])

if 'MESONINTROSPECT' not in os.environ:
    raise RuntimeError('MESONINTROSPECT not found')

mesonintrospect = os.environ['MESONINTROSPECT']

introspect_arr = shlex.split(mesonintrospect)

# print(mesonintrospect)
# print(introspect_arr)

some_executable = introspect_arr[0]

if not os.path.isfile(some_executable):
    raise RuntimeError('{!r} does not exist'.format(mesonintrospect))

if do_print:
    print(some_executable, end='')