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:
Sebastian 2019-02-23 17:13:35 +01:00 committed by GitHub
parent c8fab94cee
commit 9379266a52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -217,7 +217,7 @@ def hasInclude(path, includes):
pass
f.close()
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
except IOError:
pass