Example #1
0
    def setup_borders(self):
        temp_borders = self.paths.generation_borders_path
        borders = PathProvider.borders_path()
        for x in self.countries:
            if x in WORLDS_NAMES:
                continue

            poly = f"{x}.poly"
            make_symlink(os.path.join(borders, poly), os.path.join(temp_borders, poly))
        make_symlink(temp_borders, os.path.join(self.paths.draft_path, "borders"))
Example #2
0
def run_gen_tool_with_recovery_country(env: Env, *args, **kwargs):
    if "data_path" not in kwargs or "output" not in kwargs:
        logger.warning("The call run_gen_tool() will be without recovery.")
        run_gen_tool(*args, **kwargs)

    prev_data_path = kwargs["data_path"]
    mwm = f"{kwargs['output']}.mwm"
    osm2ft = f"{mwm}.osm2ft"
    kwargs["data_path"] = env.paths.draft_path
    make_symlink(os.path.join(prev_data_path, osm2ft),
                 os.path.join(env.paths.draft_path, osm2ft))
    shutil.copy(os.path.join(prev_data_path, mwm),
                os.path.join(env.paths.draft_path, mwm))
    run_gen_tool(*args, **kwargs)
    shutil.move(os.path.join(env.paths.draft_path, mwm),
                os.path.join(prev_data_path, mwm))
    kwargs["data_path"] = prev_data_path