Files
comaps/tools/python/generate_styles_override.py
Konstantin Pastbin e3e4a1985a Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run:
  git remote add om-historic [om-historic.git repo url]
  git fetch --tags om-historic
  git replace squashed-history historic-commits
2025-05-08 21:10:51 +07:00

44 lines
1.5 KiB
Python
Executable File

#!/usr/bin/env python3
import sys
import os
import shutil
def copy_style_file(style_path, drules_suffix, target_path):
if not os.path.exists(style_path):
print('Path {0} is not found'.format(style_path))
return
drules_proto_path = os.path.join(style_path, 'drules_proto_design.bin')
if not os.path.exists(drules_proto_path):
print('Path {0} is not found'.format(drules_proto_path))
return
shutil.copyfile(drules_proto_path, os.path.join(target_path, 'drules_proto' + drules_suffix + '.bin'))
for density in ['6plus', 'hdpi', 'mdpi', 'xhdpi', 'xxhdpi', 'xxxhdpi']:
res_path = os.path.join(style_path, 'resources-' + density + "_design")
if os.path.exists(res_path):
shutil.copytree(res_path, os.path.join(target_path, 'resources-' + density + drules_suffix))
if len(sys.argv) < 2:
print('Usage: {0} <path_to_omim/data/styles> [<target_path>]'.format(sys.argv[0]))
sys.exit()
path_to_styles = sys.argv[1]
if not os.path.isdir(path_to_styles):
print('Invalid path to styles folder')
sys.exit()
output_name = os.path.join('' if len(sys.argv) < 3 else sys.argv[2], 'styles')
if os.path.exists(output_name):
shutil.rmtree(output_name)
os.makedirs(output_name)
paths = ['default/light', 'default/dark', 'vehicle/light', 'vehicle/dark']
suffixes = ['_default_light', '_default_dark', '_vehicle_light', '_vehicle_dark']
for i in range(0, len(paths)):
copy_style_file(os.path.join(path_to_styles, paths[i], 'out'), suffixes[i], output_name)