예제 #1
0
def requirements(txt, env):
    """ Check all requirements for installed options
    and add them to setup.py
    """
    reqs = set()
    for name in installed_options(env):
        try:
            opt_req = import_module("ltpkgbuilder.option.%s.require" % name)
            reqs.update(opt_req.install)
        except ImportError:
            raise KeyError("option '%s' does not exists" % name)

    reqs_str = ", ".join(["'%s'" % n for n in reqs])
    return "install_requires=[%s]," % reqs_str
예제 #2
0
def test_installed_options_handle_hash_key():
    cfg = {'toto': {}, 'titi': None}
    assert set(installed_options(cfg)) == {'toto', 'titi'}

    cfg['hash'] = {}
    assert set(installed_options(cfg)) == {'toto', 'titi'}