File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -190,10 +190,29 @@ def unpackPackage(workPath, tgz):
190190 os .chdir (workPath )
191191
192192
193+ def hasInclude (path ,inc ):
194+ for g in glob .glob (path + '/*' ):
195+ if os .path .isfile (g ):
196+ f = open (g ,'rt' )
197+ filedata = f .read ()
198+ f .close ()
199+ if filedata .find ('\n #include ' + inc ) >= 0 :
200+ return True
201+ elif os .path .isdir (g ) and not g .startswith ('.' ):
202+ if hasInclude (g , inc ) is True :
203+ return True
204+ return False
205+
206+
193207def scanPackage (workPath , cppcheck , jobs ):
194208 print ('Analyze..' )
195209 os .chdir (workPath )
196- cmd = 'nice ' + cppcheck + ' ' + jobs + ' -D__GCC__ --inconclusive --enable=style --library=posix --platform=unix64 --template=daca2 -rp=temp temp'
210+ libraries = ' --library=posix'
211+ if hasInclude ('<wx/string.h>' ):
212+ libraries += ' --library=wxwidgets'
213+ if hasInclude ('<QString>' ):
214+ libraries += ' --library=qt'
215+ cmd = 'nice ' + cppcheck + ' ' + jobs + libraries + ' -D__GCC__ --inconclusive --enable=style --platform=unix64 --template=daca2 -rp=temp temp'
197216 print (cmd )
198217 startTime = time .time ()
199218 p = subprocess .Popen (cmd .split (), stdout = subprocess .PIPE , stderr = subprocess .PIPE )
You can’t perform that action at this time.
0 commit comments