Debian Codegraph @

vendored-meson/meson/test cases/common/22 object extraction/check-obj.py

raw
1 #! /usr/bin/env python3
2
3 import json
4 import sys
5 import os
6
7 cc = None
8 output = None
9
10 # Only the ninja backend produces compile_commands.json
11 if sys.argv[1] == 'ninja':
12 with open('compile_commands.json') as f:
13 cc = json.load(f)
14 output = {x['output'] for x in cc}
15
16 for obj in sys.argv[2:]:
17 if not os.path.exists(obj):
18 sys.exit(f'File {obj} not found.')
19 if sys.argv[1] == 'ninja' and obj not in output:
20 sys.exit(1)
21 print('Verified', obj)