Exemplo n.º 1
0
    def test_simple_replacing_inside_file(self):
        req = "dependency-{{ branch }}"
        req_fn = os.path.join(self.tmp, "requirements.txt")

        with open(req_fn, "w") as f:
            f.write(req)

        replace_template_files(root_directory=self.tmp, variables={"branch": "test"})

        assert_equals("dependency-test", open(req_fn).read())
Exemplo n.º 2
0
def replace_templates(env):
    dist = _get_distribution()
    comm_vars = get_common_variables(dist)

    build_task = env.get_task('build')
    build = build_task.command_class(build_task.distribution)
    build.set_undefined_options('build', ('build_lib', 'build_lib'))

    comm_vars['build_lib'] = build.build_lib

    replace_template_files(
        root_directory=os.curdir,
        variables=comm_vars,
        subdirs=getattr(options, "template_files_directories", None)
    )
Exemplo n.º 3
0
def get_new_dependencies(dir, accepted_tag_pattern=None, branch="master"):
    
    version = compute_version(get_git_describe(repository_directory=dir, fix_environment=True, accepted_tag_pattern=accepted_tag_pattern))
    control = os.path.join(dir, 'debian', 'control')

    version = ".".join(map(str, version))
    
    ### FIXME: We shall not do this again AND should only use templates
    from citools.build import replace_template_files
    replace_template_files(root_directory=dir, variables={
        'branch' : branch,
        'version' : version,
    })

    
    cfile = ControlFile(filename=control)
    packages = cfile.get_packages()

    for p in packages:
        p.version = version

    return packages