Debian Codegraph @

src/tools/find_meson

raw
1 #!/usr/bin/env python3
2 #
3 # Returns the path to the meson binary, for cases where we need to call it as
4 # part of the build, e.g. to install into tmp_install/ for the tests.
5
6 import os
7 import shlex
8 import sys
9
10 to_print = []
11
12 if 'MUON_PATH' in os.environ:
13 to_print += ['muon', os.environ['MUON_PATH']]
14 else:
15 mesonintrospect = os.environ['MESONINTROSPECT']
16 components = shlex.split(mesonintrospect)
17
18 if len(components) < 2:
19 print('expected more than two components, got: %s' % components)
20 sys.exit(1)
21
22 if components[-1] != 'introspect':
23 print('expected introspection at the end')
24 sys.exit(1)
25
26 to_print += ['meson'] + components[:-1]
27
28 print('\n'.join(to_print), end='')
29
30 sys.exit(0)