#NEWLINE# def searchProject( project , terms , out , replaceTerms = None , fileTypes = None , caseSensitive = True ) : #NEWLINE# #INDENT# if ( not terms ) : #NEWLINE# #INDENT# return 0 #NEWLINE# #UNINDENT# projectFilePath = os . path . join ( project . path , devon . projects . projectFileName ) #NEWLINE# paths = ( ( [ projectFilePath ] + project . getSources ( ) ) + project . getTestSources ( ) ) #NEWLINE# if fileTypes : #NEWLINE# #INDENT# patterns = fileTypes . split ( ',' ) #NEWLINE# def fileFilter( path , patterns ) : #NEWLINE# #INDENT# for pattern in patterns : #NEWLINE# #INDENT# if fnmatch . fnmatch ( path , pattern . strip ( ) ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# #UNINDENT# return False #NEWLINE# #UNINDENT# paths = [ path for path in paths if fileFilter ( path , patterns ) ] #NEWLINE# #UNINDENT# findCount = 0 #NEWLINE# for filePath in paths : #NEWLINE# #INDENT# fullPath = os . path . join ( project . path , filePath ) #NEWLINE# if ( os . path . isfile ( fullPath ) and isSearchable ( fullPath ) ) : #NEWLINE# #INDENT# findCount += searchFile ( fullPath , terms , replaceTerms , out , caseSensitive ) #NEWLINE# #UNINDENT# #UNINDENT# for childProject in project . getChildProjects ( ) : #NEWLINE# #INDENT# findCount += searchProject ( childProject , terms , out , replaceTerms , fileTypes , caseSensitive ) #NEWLINE# #UNINDENT# return findCount