def find_roots(path, file_sig='*.plug'):
 roots = set()
 for (root, dirnames, filenames) in os.walk(path, followlinks=True):
  for filename in fnmatch.filter(filenames, file_sig):
   dir_to_add = os.path.dirname(os.path.join(root, filename))
   relative = os.path.relpath(os.path.realpath(dir_to_add), os.path.realpath(path))
   for subelement in relative.split(os.path.sep):
    if (subelement in ('.', '..')):
     continue
    if (subelement.startswith('.') or (subelement == '__pycache__')):
     log.debug(('Ignore %s' % dir_to_add))
     break
   else:
    roots.add(dir_to_add)
 return roots

def find_roots ( path , file_sig = '*.plug' ) : roots = set ( ) for ( root , dirnames , filenames ) in os . walk ( path , followlinks = True ) : for filename in fnmatch . filter ( filenames , file_sig ) : dir_to_add = os . path . dirname ( os . path . join ( root , filename ) ) relative = os . path . relpath ( os . path . realpath ( dir_to_add ) , os . path . realpath ( path ) ) for subelement in relative . split ( os . path . sep ) : if ( subelement in ( '.' , '..' ) ) : continue if ( subelement . startswith ( '.' ) or ( subelement == '__pycache__' ) ) : log . debug ( ( 'Ignore %s' % dir_to_add ) ) break else : roots . add ( dir_to_add ) return roots
collects all the paths from path recursively that contains files of type file_sig .