| 1 |
#!/usr/bin/env python3 |
| 2 |
|
| 3 |
import os |
| 4 |
import sys |
| 5 |
import shlex |
| 6 |
|
| 7 |
do_print = False |
| 8 |
|
| 9 |
if len(sys.argv) > 1: |
| 10 |
do_print = bool(sys.argv[1]) |
| 11 |
|
| 12 |
if 'MESONINTROSPECT' not in os.environ: |
| 13 |
raise RuntimeError('MESONINTROSPECT not found') |
| 14 |
|
| 15 |
mesonintrospect = os.environ['MESONINTROSPECT'] |
| 16 |
|
| 17 |
introspect_arr = shlex.split(mesonintrospect) |
| 18 |
|
| 19 |
# print(mesonintrospect) |
| 20 |
# print(introspect_arr) |
| 21 |
|
| 22 |
some_executable = introspect_arr[0] |
| 23 |
|
| 24 |
if not os.path.isfile(some_executable): |
| 25 |
raise RuntimeError(f'{mesonintrospect!r} does not exist') |
| 26 |
|
| 27 |
if do_print: |
| 28 |
print(some_executable, end='') |