Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMaksim Andrianov <maksimandrianov1@gmail.com>2019-05-23 17:24:25 +0300
committergmoryes <gmoryes@gmail.com>2019-05-23 20:09:54 +0300
commit6431847809f13a4c4142dee7cd4792870b862a3a (patch)
treedc3d2e4cd4e3adf54d87ed7a237f2f6303dd5433 /tools
parentb075f5f771d2af5efff97296e1ad9b0f250b60a1 (diff)
[python] Added stage_external_resources.
Diffstat (limited to 'tools')
-rw-r--r--tools/python/maps_generator/generator/env.py4
-rw-r--r--tools/python/maps_generator/maps_generator.py26
2 files changed, 29 insertions, 1 deletions
diff --git a/tools/python/maps_generator/generator/env.py b/tools/python/maps_generator/generator/env.py
index d5b91297b4..cf2b0cf1d1 100644
--- a/tools/python/maps_generator/generator/env.py
+++ b/tools/python/maps_generator/generator/env.py
@@ -142,6 +142,10 @@ class Env:
return stage_name not in self._skipped_stages
@property
+ def external_resources_path(self):
+ return os.path.join(self.mwm_path, "external_resources.txt")
+
+ @property
def id_to_wikidata_path(self):
return os.path.join(self.intermediate_path, "id_to_wikidata.csv")
diff --git a/tools/python/maps_generator/maps_generator.py b/tools/python/maps_generator/maps_generator.py
index 82a923a48b..fd3f7574c2 100644
--- a/tools/python/maps_generator/maps_generator.py
+++ b/tools/python/maps_generator/maps_generator.py
@@ -228,6 +228,28 @@ def stage_countries_txt(env):
@stage
+def stage_external_resources(env):
+ resources = [os.path.join(file, env.user_resource_path)
+ for file in os.listdir(env.user_resource_path)
+ if file.endswith(".ttf")]
+ for ttf_file in resources:
+ shutil.copy2(ttf_file, env.intermediate_path)
+
+ shutil.copy2(os.path.join(env.user_resource_path, "WorldCoasts_obsolete.mwm"),
+ env.mwm_path)
+
+ for file in os.listdir(env.mwm_path):
+ if file.startswith(WORLD_NAME) and file.endswith(".mwm"):
+ resources.append(os.path.join(env.mwm_path, file))
+
+ resources.sort()
+ with open(env.external_resources_path, "w") as f:
+ for resource in resources:
+ fd = os.open(resource, os.O_RDONLY)
+ f.write(f"{os.path.basename(resource)} {os.fstat(fd).st_size}")
+
+
+@stage
def stage_cleanup(env):
osm2ft_path = os.path.join(env.out_path, "osm2ft")
os.makedirs(osm2ft_path, exist_ok=True)
@@ -250,7 +272,8 @@ STAGES = [s.__name__ for s in
(stage_download_external, stage_download_production_external,
stage_download_and_convert_planet, stage_update_planet,
stage_coastline, stage_preprocess, stage_features, stage_mwm,
- stage_descriptions, stage_countries_txt, stage_cleanup)]
+ stage_descriptions, stage_countries_txt, stage_external_resources,
+ stage_cleanup)]
ALL_STAGES = STAGES + COUNTRIES_STAGES
@@ -308,6 +331,7 @@ def generate_maps(env):
stage_mwm(env)
stage_descriptions(env)
stage_countries_txt(env)
+ stage_external_resources(env)
stage_cleanup(env)