diff options
Diffstat (limited to 'Build/source/libs/harfbuzz/harfbuzz-src/src/check-includes.py')
-rw-r--r-- | Build/source/libs/harfbuzz/harfbuzz-src/src/check-includes.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/check-includes.py b/Build/source/libs/harfbuzz/harfbuzz-src/src/check-includes.py index 88eaa2eaa92..ed201aa3e0a 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/check-includes.py +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/check-includes.py @@ -4,10 +4,21 @@ import sys, os, re os.chdir (os.getenv ('srcdir', os.path.dirname (__file__))) +def removeprefix(s, prefix): + if s.startswith(prefix): + return s[len(prefix):] + else: + return s[:] + HBHEADERS = [os.path.basename (x) for x in os.getenv ('HBHEADERS', '').split ()] or \ [x for x in os.listdir ('.') if x.startswith ('hb') and x.endswith ('.h')] -HBSOURCES = [os.path.basename (x) for x in os.getenv ('HBSOURCES', '').split ()] or \ - [x for x in os.listdir ('.') if x.startswith ('hb') and x.endswith (('.cc', '.hh'))] + +HBSOURCES = [ + removeprefix(x, 'src%s' % os.path.sep) for x in os.getenv ('HBSOURCES', '').split () +] or [ + x for x in os.listdir ('.') if x.startswith ('hb') and x.endswith (('.cc', '.hh')) +] + stat = 0 @@ -25,7 +36,7 @@ for x in HBSOURCES: with open (x, 'r', encoding='utf-8') as f: content = f.read () includes = re.findall (r'#.*include.*', content) if includes: - if not len (re.findall (r'"hb.*\.hh"', includes[0])): + if not len (re.findall (r'".*\.hh"', includes[0])): print ('failure on %s' % x) stat = 1 |