diff options
author | Maksim Andrianov <maksimandrianov1@gmail.com> | 2019-05-27 19:55:29 +0300 |
---|---|---|
committer | mpimenov <mpimenov@users.noreply.github.com> | 2019-05-29 16:58:56 +0300 |
commit | 0f280664adb1da1a8e92c84d3b82c851cff853fa (patch) | |
tree | 156daf8aa88ee462f24503398f4377358bf0d2c6 /tools | |
parent | 2a97d57399e9d12dc8ce4455de56a89fdcedc949 (diff) |
[python] Improved usage.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/python/maps_generator/generator/env.py | 18 | ||||
-rw-r--r-- | tools/python/maps_generator/maps_generator.py | 6 |
2 files changed, 16 insertions, 8 deletions
diff --git a/tools/python/maps_generator/generator/env.py b/tools/python/maps_generator/generator/env.py index ad8dca2851..111d400ec5 100644 --- a/tools/python/maps_generator/generator/env.py +++ b/tools/python/maps_generator/generator/env.py @@ -98,6 +98,14 @@ class Env: symlink_force(self.temp_borders_path, os.path.join(self.draft_path, "borders")) + self.osm2ft_path = os.path.join(self.out_path, "osm2ft") + if os.path.isdir(self.osm2ft_path): + for x in os.listdir(self.osm2ft_path): + p = os.path.join(self.osm2ft_path, x) + if os.path.isfile(p) and x.endswith(".mwm.osm2ft"): + shutil.move(p, os.path.join(self.mwm_path, x)) + self._create_if_not_exist(self.osm2ft_path) + self.node_storage = settings.NODE_STORAGE self.user_resource_path = settings.USER_RESOURCE_PATH @@ -116,10 +124,6 @@ class Env: self._subprocess_out = None self._subprocess_countries_out = {} - self.descriptions_path = os.path.join(self.intermediate_path, - "descriptions") - self._create_if_not_exist(self.descriptions_path) - _write_version(self.out_path, self.planet_version) self._skipped_stages = set(self.skip) @@ -147,6 +151,12 @@ class Env: return stage_name not in self._skipped_stages @property + def descriptions_path(self): + path = os.path.join(self.intermediate_path, "descriptions") + self._create_if_not_exist(self.descriptions_path) + return path + + @property def localads_path(self): path = os.path.join(self.out_path, f"localads_{self.mwm_version}") self._create_if_not_exist(path) diff --git a/tools/python/maps_generator/maps_generator.py b/tools/python/maps_generator/maps_generator.py index 78e15d7868..f82d58ee0f 100644 --- a/tools/python/maps_generator/maps_generator.py +++ b/tools/python/maps_generator/maps_generator.py @@ -306,14 +306,12 @@ def stage_statistics(env): @stage def stage_cleanup(env): - osm2ft_path = os.path.join(env.out_path, "osm2ft") - os.makedirs(osm2ft_path, exist_ok=True) logger.info(f"osm2ft files will be moved from {env.out_path} " - f"to {osm2ft_path}.") + f"to {env.osm2ft_path}.") for x in os.listdir(env.mwm_path): p = os.path.join(env.mwm_path, x) if os.path.isfile(p) and x.endswith(".mwm.osm2ft"): - shutil.move(p, os.path.join(osm2ft_path, x)) + shutil.move(p, os.path.join(env.osm2ft_path, x)) logger.info(f"{env.draft_path} will be removed.") shutil.rmtree(env.draft_path) |