Exemplo n.º 1
0
def test_src_dir():
    pkg_cfg = {}
    assert_raises(KeyError, lambda: src_dir(pkg_cfg))

    pkg_cfg['base'] = {}
    assert_raises(KeyError, lambda: src_dir(pkg_cfg))

    pkg_cfg['base']['pkgname'] = 'toto'
    assert_raises(KeyError, lambda: src_dir(pkg_cfg))

    pkg_cfg['base']['namespace'] = None
    dir1 = src_dir(pkg_cfg)
    pkg_cfg['base']['namespace'] = 'oa'
    dir2 = src_dir(pkg_cfg)

    assert dir1 != dir2
Exemplo n.º 2
0
def setup(txt, env):
    """ Find all objects defined as plugins and install them
    as entry points
    """
    # walk all files:
    pkg_dir = src_dir(env)

    entry_points = find_plugins(pkg_dir)

    entry_points_msg = ["entry_points={"]
    for gr, pgs in entry_points.items():
        entry_points_msg.append(" " * 8 + "'%s': [" % gr)
        for plugin in pgs:
            name = plugin.split(":")[-1]
            entry_points_msg.append(" " * 12 + "'%s = %s'," % (name, plugin))
        entry_points_msg.append(" " * 8 + "],")
    entry_points_msg.append(" " * 4 + "},")

    return "\n".join(entry_points_msg)
Exemplo n.º 3
0
def get_src_pth(txt, env):
    return src_dir(env)