示例#1
0
def get_changedir(env):
    "changedir = {envdir}"
    from ctox.subst import replace_braces
    changedir = _get_env_maybe(env, 'testenv', 'changedir')
    if changedir:
        return replace_braces(changedir, env)
    else:
        return env.toxinidir
示例#2
0
文件: config.py 项目: rmcgibbo/ctox
def get_changedir(env):
    "changedir = {envdir}"
    from ctox.subst import replace_braces
    changedir = _get_env_maybe(env, 'testenv', 'changedir')
    if changedir:
        return replace_braces(changedir, env)
    else:
        return env.toxinidir
示例#3
0
文件: config.py 项目: rmcgibbo/ctox
def get_commands(env):
    from ctox.subst import split_on, replace_braces
    # TODO allow for running over new lines? Is this correct at all?
    global_commands = _get(env.config, 'testenv', 'commands')
    env_commands = _get(env.config, 'testenv:%s' % env.name, 'commands')
    commands = (env_commands or global_commands)
    return [split_on(cmd)
            for cmd in split_on(replace_braces(commands, env), '\n')
            if cmd]
示例#4
0
文件: config.py 项目: rmcgibbo/ctox
def get_deps(env):
    from ctox.subst import replace_braces, expand_factor_conditions
    env_deps = _get_env_maybe(env, "testenv", "deps").strip()

    if env_deps.startswith('-r'):
        requirements_txt = replace_braces(env_deps[2:].strip(), env)
        with open(requirements_txt) as f:
            env_deps = f.read().strip()

    env_deps = [replace_braces(expand_factor_conditions(d, env),
                               env)
                for d in env_deps.split("\n")
                if d]

    env_deps = [d for d in sum((s.split() for s in env_deps), [])
                if not re.match("(pip|conda)([=<>!]|$)", d)]

    return ["pip"] + env_deps
示例#5
0
def get_commands(env):
    from ctox.subst import split_on, replace_braces
    # TODO allow for running over new lines? Is this correct at all?
    global_commands = _get(env.config, 'testenv', 'commands')
    env_commands = _get(env.config, 'testenv:%s' % env.name, 'commands')
    commands = (env_commands or global_commands)
    return [
        split_on(cmd) for cmd in split_on(replace_braces(commands, env), '\n')
        if cmd
    ]
示例#6
0
def get_deps(env):
    from ctox.subst import replace_braces, expand_factor_conditions
    env_deps = _get_env_maybe(env, "testenv", "deps").strip()

    if env_deps.startswith('-r'):
        requirements_txt = replace_braces(env_deps[2:].strip(), env)
        with open(requirements_txt) as f:
            env_deps = f.read().strip()

    env_deps = [
        replace_braces(expand_factor_conditions(d, env), env)
        for d in env_deps.split("\n") if d
    ]

    env_deps = [
        d for d in sum((s.split() for s in env_deps), [])
        if not re.match("(pip|conda)([=<>!]|$)", d)
    ]

    return ["pip"] + env_deps