Beispiel #1
0
def test_pkg_full_name():
    cfg = {}
    assert_raises(KeyError, lambda: pkg_full_name(create_env(cfg)))

    cfg['base'] = dict(pkgname='toto', namespace=None)
    name1 = pkg_full_name(create_env(cfg))
    cfg['base']['namespace'] = 'oa'
    name2 = pkg_full_name(create_env(cfg))

    assert name1 != name2
Beispiel #2
0
def test_pkg_full_name():
    cfg = {}
    with pytest.raises(KeyError):
        pkg_full_name(Config(cfg))

    cfg['base'] = dict(pkgname='toto', namespace=None)
    name1 = pkg_full_name(Config(cfg))
    cfg['base']['namespace'] = 'oa'
    name2 = pkg_full_name(Config(cfg))

    assert name1 != name2
Beispiel #3
0
def test_src_dir():
    cfg = {}
    with pytest.raises(KeyError):
        pkg_full_name(Config(cfg))

    cfg['base'] = dict(pkgname='toto', namespace=None)
    dir1 = src_dir(Config(cfg))
    cfg['base']['namespace'] = 'oa'
    dir2 = src_dir(Config(cfg))

    assert dir1 != dir2
Beispiel #4
0
def main(pkg_cfg):
    """Main function called to walk the package

    Args:
        pkg_cfg: (dict of (str, dict)) package configuration parameters
    """
    pkg = import_module(pkg_full_name(pkg_cfg))
    parse_plugins(pkg)
Beispiel #5
0
def environment_extensions(cfg):
    """Add more functionality to an environment.

    Args:
        cfg (Config):  current package configuration

    Returns:
        dict of str: any
    """
    return {"pkg_full_name": pkg_full_name(cfg), "src_pth": src_dir(cfg)}
Beispiel #6
0
    def environment_extensions(self, cfg):
        servers = cfg['pypi']['servers']
        if servers and servers[0]['name'] == 'pypi':
            url = "badge.fury.io/py/%s" % pkg_full_name(cfg)
            img = url + ".svg"
            badge = fmt_badge(img, url, "PyPI version", cfg['doc']['fmt'])
        else:
            badge = ""

        return {"badge": badge, "auto_classifiers": auto_classifiers(cfg)}
Beispiel #7
0
def environment_extensions(env):
    """Add more functionality to an environment.

    Args:
        env (jinja2.Environment):

    Returns:
        dict of str: any
    """
    return {"pkg_full_name": pkg_full_name(env),
            "src_pth": src_dir(env)}
Beispiel #8
0
def main(env, target=".", overwrite=False):
    """Main function called to walk the package

    Args:
        env: (dict of (str, dict)) package configuration parameters
        target (str): place to write plugin def into
        overwrite (bool): whether or not to overwrite previous definition
                          files. Default to False.
    """
    del target
    del overwrite
    pkg = import_module(pkg_full_name(env))
    parse_plugins(pkg)
Beispiel #9
0
def environment_extensions(cfg):
    """Add more functionality to an environment.

    Args:
        cfg (Config):  current package configuration

    Returns:
        dict of str: any
    """
    url = "badge.fury.io/py/%s" % pkg_full_name(cfg)
    img = url + ".svg"
    badge = fmt_badge(img, url, "PyPI version", cfg['doc']['fmt'])

    return {"badge": badge, "auto_classifiers": auto_classifiers(cfg)}
Beispiel #10
0
def environment_extensions(env):
    """Add more functionality to an environment.

    Args:
        env (jinja2.Environment):

    Returns:
        dict of str: any
    """
    url = "badge.fury.io/py/%s" % pkg_full_name(env)
    img = url + ".svg"
    badge = fmt_badge(img, url, "PyPI version")

    return {"badge": badge,
            "auto_classifiers": auto_classifiers(env)}
Beispiel #11
0
 def environment_extensions(self, cfg):
     return {"pkg_full_name": pkg_full_name(cfg), "src_pth": src_dir(cfg)}
Beispiel #12
0
 def environment_extensions(self, cfg):
     return {"pkg_full_name": pkg_full_name(cfg)}