diff --git a/tools/donate-cpu.py b/tools/donate-cpu.py index c5e808eaf..43f218fb2 100644 --- a/tools/donate-cpu.py +++ b/tools/donate-cpu.py @@ -196,7 +196,7 @@ def unpackPackage(workPath, tgz): os.chdir(workPath) -def hasInclude(path, inc): +def hasInclude(path, includes): for root, _, files in os.walk(path): for name in files: filename = os.path.join(root, name) @@ -210,8 +210,9 @@ def hasInclude(path, inc): # Python3 directly reads the data into a string object that has no decode() pass f.close() - if filedata.find('\n#include ' + inc) >= 0: - return True + for inc in includes: + if filedata.find('\n#include ' + inc) >= 0: + return True except IOError: pass return False @@ -221,15 +222,15 @@ def scanPackage(workPath, cppcheck, jobs): print('Analyze..') os.chdir(workPath) libraries = ' --library=posix' - if hasInclude('temp', ''): + if hasInclude('temp', ['', '', ''): + if hasInclude('temp', ['']): libraries += ' --library=zlib' - if hasInclude('temp', ''): + if hasInclude('temp', ['', '', '