def get_root_modules(paths):
 modules = []
 spy_modules = []
 for path in paths:
  spy_modules += module_list(path)
 spy_modules = set(spy_modules)
 if ('__init__' in spy_modules):
  spy_modules.remove('__init__')
 spy_modules = list(spy_modules)
 if ('rootmodules' in modules_db):
  return (spy_modules + modules_db['rootmodules'])
 t = time()
 modules = list(sys.builtin_module_names)
 for path in sys.path:
  modules += module_list(path)
  if ((time() - t) > TIMEOUT_GIVEUP):
   print 'Module list generation is taking too long, we give up.\n'
   modules_db['rootmodules'] = []
   return []
 modules = set(modules)
 excluded_modules = (['__init__'] + spy_modules)
 for mod in excluded_modules:
  if (mod in modules):
   modules.remove(mod)
 modules = list(modules)
 modules_db['rootmodules'] = modules
 return (spy_modules + modules)

def get_root_modules ( paths ) : modules = [ ] spy_modules = [ ] for path in paths : spy_modules += module_list ( path ) spy_modules = set ( spy_modules ) if ( '__init__' in spy_modules ) : spy_modules . remove ( '__init__' ) spy_modules = list ( spy_modules ) if ( 'rootmodules' in modules_db ) : return ( spy_modules + modules_db [ 'rootmodules' ] ) t = time ( ) modules = list ( sys . builtin_module_names ) for path in sys . path : modules += module_list ( path ) if ( ( time ( ) - t ) > TIMEOUT_GIVEUP ) : print 'Module list generation is taking too long, we give up.\n' modules_db [ 'rootmodules' ] = [ ] return [ ] modules = set ( modules ) excluded_modules = ( [ '__init__' ] + spy_modules ) for mod in excluded_modules : if ( mod in modules ) : modules . remove ( mod ) modules = list ( modules ) modules_db [ 'rootmodules' ] = modules return ( spy_modules + modules )
returns list of names of all modules from pythonpath folders .