summaryrefslogtreecommitdiff
path: root/scripts/check-boilerplate
blob: 311f95b801f74c9e924da0370daa6beec3d1b2cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/python

import glob
import os
import sys

for file in glob.glob('src/*.h'):
    for line in open(file).readlines():
        if line.find('@file') != -1:
            filename = line.strip().split()[2]
            if filename != file:
                print(f'AWOOGA: {file} {filename}')
                sys.exit(1)
        elif line.find('ifndef') != -1:
            guard = line.strip().split()[1]
            if not guard.startswith('LIBDCP'):
                print(f'AWOOGA: {file} {guard}')
                sys.exit(1)
            correct_guard = 'LIBDCP_' + os.path.basename(file).upper().replace('.', '_')
            if guard != correct_guard:
                print(f'AWOOGA: {file} {guard} {correct_guard}')
                sys.exit(1)