donate-cpu.py: Improve regex to find more includes. (#1688)
Now also found: - Includes directly at the beginning of a file - Indented includes - Includes where there is no white-space between "include" and header name
This commit is contained in:
parent
c8fab94cee
commit
9379266a52
|
@ -217,7 +217,7 @@ def hasInclude(path, includes):
|
||||||
pass
|
pass
|
||||||
f.close()
|
f.close()
|
||||||
re_includes = [re.escape(inc) for inc in includes]
|
re_includes = [re.escape(inc) for inc in includes]
|
||||||
if re.search('\n#[ \t]*include[ \t]+(' + '|'.join(re_includes) + ')', filedata):
|
if re.search('^[ \t]*#[ \t]*include[ \t]*(' + '|'.join(re_includes) + ')', filedata, re.MULTILINE):
|
||||||
return True
|
return True
|
||||||
except IOError:
|
except IOError:
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Reference in New Issue