__init__.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:incubator-ariatosca 作者: apache 项目源码 文件源码
def install_aria_extensions(strict=True):
    """
    Loads all Python packages with names beginning with ``aria_extension_`` and calls their
    ``aria_extension`` initialization entry points if they have them.

    :param strict: if ``True`` tries to load extensions while taking into account the versions
     of their dependencies, otherwise ignores versions
    :type strict: bool
    """
    for loader, module_name, _ in iter_modules():
        if module_name.startswith('aria_extension_'):
            loader.find_module(module_name).load_module(module_name)
    for entry_point in pkg_resources.iter_entry_points(group='aria_extension'):
        # It should be possible to enable non strict loading - use the package that is already
        # installed inside the environment, and forgo the version demand
        if strict:
            entry_point.load()
        else:
            entry_point.resolve()
    extension.init()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号