'Prepare and build the website.'

def _build_website(self):

    theme_file = os.path.abspath(os.path.join('www', 'qute.css'))
    shutil.copy(theme_file, self._themedir)
    outdir = self._args.website[0]
    for (root, _dirs, files) in os.walk(os.getcwd()):
        for filename in files:
            (basename, ext) = os.path.splitext(filename)
            if ((ext != '.asciidoc') or (basename in ['header', 'OpenSans-License'])):
                continue
            self._build_website_file(root, filename)
    copy = {'icons': 'icons', 'doc/img': 'doc/img', 'www/media': 'media/'}
    for (src, dest) in copy.items():
        full_dest = os.path.join(outdir, dest)
        try:
            shutil.rmtree(full_dest)
        except FileNotFoundError:
            pass
        shutil.copytree(src, full_dest)
    for (dst, link_name) in [('README.html', 'index.html'), (os.path.join('doc', 'quickstart.html'), 'quickstart.html')]:
        try:
            os.symlink(dst, os.path.join(outdir, link_name))
        except FileExistsError:
            pass
