'Call pydoctor\'s entry point with options which will generate HTML
documentation for the specified package\'s API.
@type projectName: C{str}
@param projectName: The name of the package for which to generate
documentation.
@type projectURL: C{str}
@param projectURL: The location (probably an HTTP URL) of the project
on the web.
@type sourceURL: C{str}
@param sourceURL: The location (probably an HTTP URL) of the root of
the source browser for the project.
@type packagePath: L{FilePath}
@param packagePath: The path to the top-level of the package named by
C{projectName}.
@type outputPath: L{FilePath}
@param outputPath: An existing directory to which the generated API
documentation will be written.'

def build(self, projectName, projectURL, sourceURL, packagePath, outputPath):

    intersphinxes = []
    for intersphinx in intersphinxURLs:
        intersphinxes.append('--intersphinx')
        intersphinxes.append(intersphinx)
    from pydoctor.templatewriter import util
    originalTemplatefile = util.templatefile
    def templatefile(filename):
        if (filename in ['summary.html', 'index.html', 'common.html']):
            twistedPythonDir = FilePath(__file__).parent()
            templatesDir = twistedPythonDir.child('_pydoctortemplates')
            return templatesDir.child(filename).path
        else:
            return originalTemplatefile(filename)
    monkeyPatch = MonkeyPatcher((util, 'templatefile', templatefile))
    monkeyPatch.patch()
    from pydoctor.driver import main
    args = ([u'--project-name', projectName, u'--project-url', projectURL, u'--system-class', u'twisted.python._pydoctor.TwistedSystem', u'--project-base-dir', packagePath.parent().path, u'--html-viewsource-base', sourceURL, u'--add-package', packagePath.path, u'--html-output', outputPath.path, u'--html-write-function-pages', u'--quiet', u'--make-html'] + intersphinxes)
    args = [arg.encode('utf-8') for arg in args]
    main(args)
    monkeyPatch.restore()
