mkmesonconf.py

changeset 38653
f5810607660c
parent 38538
b542a6787116
child 42357
0073491e35ff
equal deleted inserted replaced
38650:1b4854036b36 38653:f5810607660c
28 """ 28 """
29 29
30 import html 30 import html
31 import json 31 import json
32 import os 32 import os
33 import shlex
33 import subprocess 34 import subprocess
34 import sys 35 import sys
35 36
36 37
37 try: 38 try:
38 introspect = os.environ['MESONINTROSPECT'] 39 introspect = os.environ['MESONINTROSPECT']
39 except KeyError: 40 except KeyError:
40 print('Meson is too old; ' 41 print('Meson is too old; '
41 'it does not set MESONINTROSPECT for postconf scripts.') 42 'it does not set MESONINTROSPECT for postconf scripts.')
42 sys.exit(1) 43 sys.exit(1)
44 else:
45 introspect = shlex.split(introspect)
43 46
44 try: 47 try:
45 build_root = os.environ['MESON_BUILD_ROOT'] 48 build_root = os.environ['MESON_BUILD_ROOT']
46 except KeyError: 49 except KeyError:
47 print('Meson is too old; ' 50 print('Meson is too old; '
54 return html.escape(repr(obj)) 57 return html.escape(repr(obj))
55 else: 58 else:
56 return repr(obj) 59 return repr(obj)
57 60
58 61
59 conf = subprocess.check_output([introspect, '--buildoptions', build_root], 62 conf = subprocess.check_output(introspect + ['--buildoptions', build_root],
60 universal_newlines=True) 63 universal_newlines=True)
61 conf = json.loads(conf) 64 conf = json.loads(conf)
62 65
63 settings = ' '.join('{}={}'.format(option['name'], tostr(option['value'])) 66 settings = ' '.join('{}={}'.format(option['name'], tostr(option['value']))
64 for option in sorted(conf, key=lambda x: x['name'])) 67 for option in sorted(conf, key=lambda x: x['name']))

mercurial