def install_plugin(site, plugin_name, output_dir=None, show_install_notes=False):
 LOGGER.notice(u"Installing plugin '{0}'".format(plugin_name))
 plugin_installer_info = site.plugin_manager.getPluginByName(u'plugin', u'Command')
 if (plugin_installer_info is None):
  LOGGER.error(u'Internal error: cannot find the "plugin" plugin which is supposed to come with Nikola!')
  return False
 if (not plugin_installer_info.is_activated):
  site.plugin_manager.activatePluginByName(plugin_installer_info.name)
  plugin_installer_info.plugin_object.set_site(site)
 plugin_installer = plugin_installer_info.plugin_object
 options = {}
 for option in plugin_installer.cmd_options:
  options[option[u'name']] = option[u'default']
 options[u'install'] = plugin_name
 options[u'output_dir'] = output_dir
 options[u'show_install_notes'] = show_install_notes
 if (plugin_installer.execute(options=options) > 0):
  return False
 site.plugin_manager.collectPlugins()
 site.compiler_extensions = site._activate_plugins_of_category(u'CompilerExtension')
 return True

def install_plugin ( site , plugin_name , output_dir = None , show_install_notes = False ) : LOGGER . notice ( u"Installing plugin '{0}'" . format ( plugin_name ) ) plugin_installer_info = site . plugin_manager . getPluginByName ( u'plugin' , u'Command' ) if ( plugin_installer_info is None ) : LOGGER . error ( u'Internal error: cannot find the "plugin" plugin which is supposed to come with Nikola!' ) return False if ( not plugin_installer_info . is_activated ) : site . plugin_manager . activatePluginByName ( plugin_installer_info . name ) plugin_installer_info . plugin_object . set_site ( site ) plugin_installer = plugin_installer_info . plugin_object options = { } for option in plugin_installer . cmd_options : options [ option [ u'name' ] ] = option [ u'default' ] options [ u'install' ] = plugin_name options [ u'output_dir' ] = output_dir options [ u'show_install_notes' ] = show_install_notes if ( plugin_installer . execute ( options = options ) > 0 ) : return False site . plugin_manager . collectPlugins ( ) site . compiler_extensions = site . _activate_plugins_of_category ( u'CompilerExtension' ) return True
installs a new plugin .