5 os.chdir (os.environ.get ('srcdir', os.path.dirname (__file__)))
7 HBHEADERS = os.environ.get ('HBHEADERS', '').split () or \
8 [x for x in os.listdir ('.') if x.startswith ('hb') and x.endswith ('.h')]
9 HBSOURCES = os.environ.get ('HBSOURCES', '').split () or \
10 [x for x in os.listdir ('.') if x.startswith ('hb') and x.endswith (('.cc', '.hh'))]
14 print ('Checking that public header files #include "hb-common.h" or "hb.h" first (or none)')
16 if x == 'hb.h' or x == 'hb-common.h': continue
17 with open (x, 'r', encoding='utf-8') as f: content = f.read ()
18 first = re.findall (r'#.*include.*', content)[0]
19 if first not in ['#include "hb.h"', '#include "hb-common.h"']:
20 print ('failure on %s' % x)
23 print ('Checking that source files #include a private header first (or none)')
25 with open (x, 'r', encoding='utf-8') as f: content = f.read ()
26 includes = re.findall (r'#.*include.*', content)
28 if not len (re.findall (r'"hb.*\.hh"', includes[0])):
29 print ('failure on %s' % x)
32 print ('Checking that there is no #include <hb-*.h>')
33 for x in HBHEADERS + HBSOURCES:
34 with open (x, 'r', encoding='utf-8') as f: content = f.read ()
35 if re.findall ('#.*include.*<.*hb', content):
36 print ('failure on %s' % x)