MCPcopy Create free account
hub / github.com/AstroPrint/AstroBox / removePlugin

Method removePlugin

src/astroprint/plugin/__init__.py:449–471  ·  view source on GitHub ↗
(self, pId)

Source from the content-addressed store, hash-verified

447 return False
448
449 def removePlugin(self, pId):
450 plugin = self.getPlugin(pId)
451
452 if plugin:
453 #Tell the plugin
454 plugin.onRemove()
455
456 #remove from the internal structure
457 del self._plugins[pId]
458
459 #remove the files from its directory
460 userPluginsDir = settings().getBaseFolder('userPlugins')
461 shutil.rmtree( os.path.join(userPluginsDir, pId.replace('.','_')) )
462
463 #Tell all the listeners to the manager's [ON_PLUGIN_REMOVED] event
464 self._fireEvent('ON_PLUGIN_REMOVED', [plugin])
465
466 self._logger.info("Removed --> %s, version: %s" % (plugin.pluginId, plugin.version))
467
468 return {'removed': pId, 'providers': plugin.providers}
469
470 else:
471 return {'error': 'not_found'}
472
473 def loadPlugins(self):
474 userPluginsDir = settings().getBaseFolder('userPlugins')

Callers 1

removeSoftwarePluginFunction · 0.80

Calls 7

getPluginMethod · 0.95
_fireEventMethod · 0.95
settingsFunction · 0.90
onRemoveMethod · 0.80
joinMethod · 0.80
replaceMethod · 0.80
getBaseFolderMethod · 0.45

Tested by

no test coverage detected