'Build templates for docs models and Python API'

def build(self, docs_version):

    self.docs_path = frappe.get_app_path(self.target_app, u'www', u'docs')
    self.path = os.path.join(self.docs_path, docs_version)
    self.app_context[u'app'][u'docs_version'] = docs_version
    self.app_title = self.hooks.get(u'app_title')[0]
    self.app_path = frappe.get_app_path(self.app)
    print(u'Deleting    current...')
    shutil.rmtree(self.path, ignore_errors=True)
    os.makedirs(self.path)
    self.make_home_pages()
    for (basepath, folders, files) in os.walk(self.app_path):
        if ((u'/doctype/' not in basepath) and (u'doctype' in folders)):
            module = os.path.basename(basepath)
            module_folder = os.path.join(self.models_base_path, module)
            self.make_folder(module_folder, template=u'templates/autodoc/module_home.html', context={u'name': module})
            self.update_index_txt(module_folder)
        if (u'/doctype/' in basepath):
            parts = basepath.split(u'/')
            (module, doctype) = (parts[(-3)], parts[(-1)])
            if (doctype != u'boilerplate'):
                self.write_model_file(basepath, module, doctype)
        if self.is_py_module(basepath, folders, files):
            self.write_modules(basepath, folders, files)
    self.copy_user_assets()
    self.add_sidebars()
    self.add_breadcrumbs_for_user_pages()
