Example #1
0
def autoremove_unavailable_plugins():
    """
    Sanitize INSTALLED_PLUGINS - something that should be done separately for all
    built in plugins, but we should not auto-remove plugins that are actually
    configured by the user or some other kind of hard dependency that should
    make execution stop if not loadable.
    """
    changed = False
    # Iterate over a copy of the set so that it is not modified during the loop
    for module_path in config["INSTALLED_PLUGINS"].copy():
        if not module_exists(module_path):
            config.clear_plugin(module_path)
            logger.error(
                ("Plugin {mod} not found and disabled. To re-enable it, run:\n"
                 "   $ kolibri plugin {mod} enable").format(mod=module_path))
            changed = True
    if changed:
        config.save()
Example #2
0
def autoremove_unavailable_plugins():
    """
    Sanitize INSTALLED_APPS - something that should be done separately for all
    build in plugins, but we should not auto-remove plugins that are actually
    configured by the user or some other kind of hard dependency that should
    make execution stop if not loadable.
    """
    global config
    changed = False
    # Iterate over a copy of the list so that it is not modified during the loop
    for module_path in config['INSTALLED_APPS'][:]:
        if not module_exists(module_path):
            config['INSTALLED_APPS'].remove(module_path)
            logger.error(
                (
                    "Plugin {mod} not found and disabled. To re-enable it, run:\n"
                    "   $ kolibri plugin {mod} enable"
                ).format(mod=module_path)
            )
            changed = True
    if changed:
        save()