1e876615028aff0dc80c60ff049d5552b6ca4fe9
[mesa.git] / src / egl / egl-entrypoint-check.py
1 #!/usr/bin/env python
2
3 import argparse
4
5 PREFIX = 'EGL_ENTRYPOINT('
6 SUFFIX = ')'
7
8 def main():
9 parser = argparse.ArgumentParser()
10 parser.add_argument('header')
11 args = parser.parse_args()
12
13 with open(args.header) as header:
14 lines = header.readlines()
15
16 entrypoints = []
17 for line in lines:
18 line = line.strip()
19 if line.startswith(PREFIX):
20 assert line.endswith(SUFFIX)
21 entrypoints.append(line[len(PREFIX):-len(SUFFIX)])
22
23 print('Checking EGL API entrypoints are sorted')
24
25 for i, _ in enumerate(entrypoints):
26 # Can't compare the first one with the previous
27 if i == 0:
28 continue
29 if entrypoints[i - 1] > entrypoints[i]:
30 print('ERROR: ' + entrypoints[i] + ' should come before ' + entrypoints[i - 1])
31 exit(1)
32
33 print('All good :)')
34
35 if __name__ == '__main__':
36 main()