Run default application loader.

    :param entry_points: List of entry points providing to Flask extensions.
    :param modules: List of Flask extensions.

    .. versionadded: 1.0.0
422771
def app_loader(app, entry_points=None, modules=None):
    
    _loader(app, lambda ext: ext(app), entry_points=entry_points,
            modules=modules)
1170406
def set_entry_points(self, names):
        
        names = util.return_set(names)
        self.entry_point_names = names
240224
def _load_class_entry_point(cls, entry_point):
        
        class_ = entry_point.load()
        setattr(class_, 'plugin_name', entry_point.name)
        return class_
1184075
def load_entry_point(self, group, name):
        """"""
        ep = self.get_entry_info(group, name)
        if ep is None:
            raise ImportError("Entry point %r not found" % ((group, name),))
        return ep.load()
385646
def load_minters_entry_point_group(self, entry_point_group):
        
        for ep in pkg_resources.iter_entry_points(group=entry_point_group):
            self.register_minter(ep.name, ep.load())
462168
def modpath_pkg_resources(module, entry_point):
    

    result = []
    try:
        path = resource_filename_mod_entry_point(module.__name__, entry_point)
    except ImportError:
        logger.warning("module '%s' could not be imported", module.__name__)
    except Exception:
        logger.warning("%r does not appear to be a valid module", module)
    else:
        if path:
            result.append(path)
    return result
1191436
protected void preloadModules() {

        // Add default ModuleModel component interface (because it cannot be added by module starter, API is not processed with annotation engine)
        JRebirthThread.getThread().getFacade().componentFactory().define(
                                                                         RegistrationPointItemBase.create()
                                                                                                  .interfaceClass(ModuleModel.class)
                                                                                                  .exclusive(false)
                                                                                                  .reverse(false));

        final ServiceLoader<ModuleStarter> loader = ServiceLoader.load(ModuleStarter.class);

        final List<ModuleStarter> modules = new ArrayList<>();
        loader.iterator().forEachRemaining(modules::add);

        modules.stream()
               .sorted((m1, m2) -> -1 * Integer.compare(m1.priority(), m2.priority()))
               .forEach(ModuleStarter::start);

    }
1259615
def load_plugins(builtin=True, others=True):
    
    for entry_point in pkg_resources.iter_entry_points('yolk.plugins'):
        #LOG.debug("load plugin %s" % entry_point)
        try:
            plugin = entry_point.load()
        except KeyboardInterrupt:
            raise
        except Exception as err_msg:
            # never want a plugin load to exit yolk
            # but we can't log here because the logger is not yet
            # configured
            warn("Unable to load plugin %s: %s" % \
                    (entry_point, err_msg), RuntimeWarning)
            continue
        if plugin.__module__.startswith('yolk.plugins'):
            if builtin:
                yield plugin
        elif others:
            yield plugin
168063
def import_or_die(module_name, entrypoint_names):
    '''
    
    '''
    log_debug("Importing {}".format(module_name))
    module_name = os.path.abspath(module_name)
    if module_name.endswith('.py'):
        module_name,ext = os.path.splitext(module_name)
    modname = os.path.basename(module_name)
    dirname = os.path.dirname(module_name)
    if dirname and dirname not in sys.path:
        sys.path.append(dirname)

    # first, try to reload code
    if modname in sys.modules:
        user_module = sys.modules.get(modname)
        user_module = importlib.reload(user_module)
    # if it isn't in sys.modules, load it for the first time, or
    # try to.
    else:
        try:
            mypaths = [ x for x in sys.path if ("Cellar" not in x and "packages" not in x)]
            # print("Loading {} from {} ({})".format(modname, dirname, mypaths))
            # user_module = importlib.import_module(modname)
            user_module = importlib.__import__(modname)
        except ImportError as e:
            log_failure("Fatal error: couldn't import module (error: {}) while executing {}".format(str(e), modname))
            raise ImportError(e)

    # if there aren't any functions to call into, then the caller
    # just wanted the module/code to be imported, and that's it.
    if not entrypoint_names:
        return

    existing_names = dir(user_module)
    for method in entrypoint_names:
        if method in existing_names:
            return getattr(user_module, method)

    if len(entrypoint_names) > 1:
        entrypoints = "one of {}".format(', '.join(entrypoint_names))
    else:
        entrypoints = entrypoint_names[0]
    raise ImportError("Required entrypoint function or symbol ({}) not found in your code".format(entrypoints))
316822
def init_app(self, app, entry_point_group='invenio_oauth2server.scopes',
                 **kwargs):
        
        self.init_config(app)

        state = _OAuth2ServerState(app, entry_point_group=entry_point_group)

        app.extensions['invenio-oauth2server'] = state
        return state
841769
def init_app(self, app):
        
        host = app.config.get('STATS_HOSTNAME', 'localhost')
        port = app.config.get('STATS_PORT', 8125)
        base_key = app.config.get('STATS_BASE_KEY', app.name)

        client = _StatsClient(
            host=host,
            port=port,
            prefix=base_key,
        )

        app.before_request(client.flask_time_start)
        app.after_request(client.flask_time_end)

        if not hasattr(app, 'extensions'):
            app.extensions = {}
        app.extensions.setdefault('stats', {})
        app.extensions['stats'][self] = client

        return client
1175182
def load_and_init(self, modules):
        
        self.load(modules)
        self.get_instances()

        return len(self.configuration_errors) == 0
720718
def init_app(self, app):
        
        app.extensions = getattr(app, "extensions", {})

        # If using Flask-SQLAlchemy, attach db.session to ModelSchema
        if has_sqla and "sqlalchemy" in app.extensions:
            db = app.extensions["sqlalchemy"].db
            self.ModelSchema.OPTIONS_CLASS.session = db.session
        app.extensions[EXTENSION_NAME] = self
710409
def load_modules(self, args):
        """"""

        # Init the plugins dict
        # Active plugins dictionnary
        self._plugins = collections.defaultdict(dict)
        # Load the plugins
        self.load_plugins(args=args)

        # Init the export modules dict
        # Active exporters dictionnary
        self._exports = collections.defaultdict(dict)
        # All available exporters dictionnary
        self._exports_all = collections.defaultdict(dict)
        # Load the export modules
        self.load_exports(args=args)

        # Restoring system path
        sys.path = sys_path
708506
def _format_entrypoint_target(ep):
    '''
    
    '''
    s = ep.module_name
    if ep.attrs:
        s += ':' + '.'.join(ep.attrs)
    return s
1021624
def add_entrypoint(self, entry_point_group):
        """"""
        for ep in iter_entry_points(group=entry_point_group):
            if not resource_isdir(ep.module_name, 'translations'):
                continue
            dirname = resource_filename(ep.module_name, 'translations')
            self.add_path(dirname)
415055
def get_roots(app=None):
    '''
    
    '''
    roots = set()
    plugins = app.config['PLUGINS'] if app else None
    for name in ENTRYPOINTS.keys():
        for ep in iter_all(name):
            if plugins is None or ep.name in plugins:
                roots.add(ep.module_name.split('.', 1)[0])
    return list(roots)