MCPcopy Index your code
hub / github.com/pyload/pyload / remove_plugins

Method remove_plugins

module/plugins/hooks/UpdateManager.py:348–388  ·  view source on GitHub ↗

Delete plugins from disk

(self, plugin_ids)

Source from the content-addressed store, hash-verified

346
347 @Expose
348 def remove_plugins(self, plugin_ids):
349 """
350 Delete plugins from disk
351 """
352 if not plugin_ids:
353 return
354
355 removed = set()
356
357 self.log_debug("Requested deletion of plugins: %s" % plugin_ids)
358
359 for plugin_type, plugin_name in plugin_ids:
360 rootplugins = os.path.join(pypath, "module", "plugins")
361
362 for basedir in ("userplugins", rootplugins):
363 py_filename = fsjoin(basedir, plugin_type, plugin_name + ".py")
364 pyc_filename = py_filename + "c"
365
366 if plugin_type == "hook":
367 try:
368 self.manager.deactivateHook(plugin_name)
369
370 except Exception, e:
371 self.log_debug(e, trace=True)
372
373 for filename in (py_filename, pyc_filename):
374 if not exists(filename):
375 continue
376
377 try:
378 os.remove(filename)
379
380 except OSError, e:
381 self.log_warning(_("Error removing `%s`") % filename, e)
382
383 else:
384 plugin_id = (plugin_type, plugin_name)
385 removed.add(plugin_id)
386
387 #: Return a list of the plugins successfully removed
388 return list(removed)

Callers 2

_update_pluginsMethod · 0.95
removePluginsMethod · 0.95

Calls 9

fsjoinFunction · 0.85
existsFunction · 0.85
log_debugMethod · 0.80
joinMethod · 0.80
deactivateHookMethod · 0.80
log_warningMethod · 0.80
_Function · 0.50
removeMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected