def register_plugin(impl, name=None):
 if (name is None):
  name = impl.name
 with REGISTRY_LOCK:
  PLUGIN_REGISTRY[name] = impl
  if (name not in PLUGIN_DEPENDENTS):
   PLUGIN_DEPENDENTS[name] = set()
  for dep in impl.dependencies:
   if (dep not in PLUGIN_DEPENDENTS):
    PLUGIN_DEPENDENTS[dep] = set()
   PLUGIN_DEPENDENTS[dep].add(name)

def register_plugin ( impl , name = None ) : if ( name is None ) : name = impl . name with REGISTRY_LOCK : PLUGIN_REGISTRY [ name ] = impl if ( name not in PLUGIN_DEPENDENTS ) : PLUGIN_DEPENDENTS [ name ] = set ( ) for dep in impl . dependencies : if ( dep not in PLUGIN_DEPENDENTS ) : PLUGIN_DEPENDENTS [ dep ] = set ( ) PLUGIN_DEPENDENTS [ dep ] . add ( name )
add a new plugin implementation to the registry .