Repo created
This commit is contained in:
parent
4af19165ec
commit
68073add76
12458 changed files with 12350765 additions and 2 deletions
43
tools/python/generate_styles_override.py
Executable file
43
tools/python/generate_styles_override.py
Executable file
|
|
@ -0,0 +1,43 @@
|
|||
#!/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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue