def create_modules_toc_file(master_package, modules, opts, name='modules'):
 text = format_heading(1, ('%s Modules' % opts.header))
 text += '.. toctree::\n'
 text += ('   :maxdepth: %s\n\n' % opts.maxdepth)
 modules.sort()
 prev_module = ''
 for module in modules:
  if module.startswith((prev_module + '.')):
   continue
  prev_module = module
  text += ('   %s\n' % module)
 write_file(name, text, opts)

def create_modules_toc_file ( master_package , modules , opts , name = 'modules' ) : text = format_heading ( 1 , ( '%s Modules' % opts . header ) ) text += '.. toctree::\n' text += ( '   :maxdepth: %s\n\n' % opts . maxdepth ) modules . sort ( ) prev_module = '' for module in modules : if module . startswith ( ( prev_module + '.' ) ) : continue prev_module = module text += ( '   %s\n' % module ) write_file ( name , text , opts )
create the modules index .