def uninstall_plugin(plug):
 plugin_name = plug[0]
 structure = []
 if os.path.isfile(resources.PLUGINS_DESCRIPTOR):
  structure = json_manager.read_json(resources.PLUGINS_DESCRIPTOR)
 structure_aux = copy.copy(structure)
 for plugin in structure_aux:
  if (plugin[u'name'] == plugin_name):
   fileName = plugin[u'plugin-descriptor']
   structure.remove(plugin)
   break
 fileName = os.path.join(resources.PLUGINS, fileName)
 plugin = json_manager.read_json(fileName)
 module = plugin.get(u'module')
 if module:
  pluginDir = os.path.join(resources.PLUGINS, module)
  folders = [pluginDir]
  for (root, dirs, files) in os.walk(pluginDir):
   pluginFiles = [os.path.join(root, f) for f in files]
   list(map(os.remove, pluginFiles))
   folders += [os.path.join(root, d) for d in dirs]
  folders.reverse()
  for f in folders:
   if os.path.isdir(f):
    os.removedirs(f)
  os.remove(fileName)
 json_manager.write_json(structure, resources.PLUGINS_DESCRIPTOR)

def uninstall_plugin ( plug ) : plugin_name = plug [ 0 ] structure = [ ] if os . path . isfile ( resources . PLUGINS_DESCRIPTOR ) : structure = json_manager . read_json ( resources . PLUGINS_DESCRIPTOR ) structure_aux = copy . copy ( structure ) for plugin in structure_aux : if ( plugin [ u'name' ] == plugin_name ) : fileName = plugin [ u'plugin-descriptor' ] structure . remove ( plugin ) break fileName = os . path . join ( resources . PLUGINS , fileName ) plugin = json_manager . read_json ( fileName ) module = plugin . get ( u'module' ) if module : pluginDir = os . path . join ( resources . PLUGINS , module ) folders = [ pluginDir ] for ( root , dirs , files ) in os . walk ( pluginDir ) : pluginFiles = [ os . path . join ( root , f ) for f in files ] list ( map ( os . remove , pluginFiles ) ) folders += [ os . path . join ( root , d ) for d in dirs ] folders . reverse ( ) for f in folders : if os . path . isdir ( f ) : os . removedirs ( f ) os . remove ( fileName ) json_manager . write_json ( structure , resources . PLUGINS_DESCRIPTOR )
uninstalls a plugin from flaskbb .