mirror of
https://github.com/ONLYOFFICE/build_tools.git
synced 2026-02-10 20:45:38 +08:00
Add method for deploy dictionaries
This commit is contained in:
@ -1475,3 +1475,59 @@ def correct_elf_rpath_directory(directory, origin, is_recursion = True):
|
||||
correct_elf_rpath_directory(file, origin)
|
||||
return
|
||||
|
||||
def copy_dictionaries(src, dst, is_hyphen = True, is_spell = True):
|
||||
if (False == is_hyphen) and (False == is_spell):
|
||||
return
|
||||
|
||||
if not is_dir(dst):
|
||||
create_dir(dst)
|
||||
|
||||
src_folder = src
|
||||
if ("/" != src[-1:]):
|
||||
src_folder += "/"
|
||||
src_folder += "*"
|
||||
for file in glob.glob(src_folder):
|
||||
if is_file(file):
|
||||
copy_file(file, dst)
|
||||
continue
|
||||
|
||||
basename = os.path.basename(file)
|
||||
if (".git" == basename):
|
||||
continue
|
||||
|
||||
if (True == is_hyphen) and (True == is_spell):
|
||||
copy_dir(file, dst + "/" + basename)
|
||||
continue
|
||||
|
||||
is_spell_present = is_file(file + "/" + basename + ".dic")
|
||||
is_hyphen_present = is_file(file + "/hyph_" + basename + ".dic")
|
||||
|
||||
is_dir_need = False
|
||||
if (is_hyphen and is_hyphen_present) or (is_spell and is_spell_present):
|
||||
is_dir_need = True
|
||||
|
||||
if not is_dir_need:
|
||||
continue
|
||||
|
||||
lang_folder = dst + "/" + basename
|
||||
create_dir(lang_folder)
|
||||
|
||||
if is_hyphen and is_hyphen_present:
|
||||
copy_dir_content(file, lang_folder, "hyph_", "")
|
||||
|
||||
if is_spell and is_spell_present:
|
||||
copy_dir_content(file, lang_folder, "", "hyph_")
|
||||
|
||||
if is_file(dst + "/en_US/en_US_thes.dat"):
|
||||
delete_file(dst + "/en_US/en_US_thes.dat")
|
||||
delete_file(dst + "/en_US/en_US_thes.idx")
|
||||
|
||||
if is_file(dst + "/ru_RU/ru_RU_oo3.dic"):
|
||||
delete_file(dst + "/ru_RU/ru_RU_oo3.dic")
|
||||
delete_file(dst + "/ru_RU/ru_RU_oo3.aff")
|
||||
|
||||
if is_file(dst + "/uk_UA/th_uk_UA.dat"):
|
||||
delete_file(dst + "/uk_UA/th_uk_UA.dat")
|
||||
delete_file(dst + "/uk_UA/th_uk_UA.idx")
|
||||
|
||||
return
|
||||
@ -116,8 +116,7 @@ def make():
|
||||
base.copy_dir(git_dir + "/document-templates/new", root_dir + "/converter/empty")
|
||||
|
||||
# dictionaries
|
||||
base.create_dir(root_dir + "/dictionaries")
|
||||
base.copy_dir_content(git_dir + "/dictionaries", root_dir + "/dictionaries", "", ".git")
|
||||
base.copy_dictionaries(git_dir + "/dictionaries", root_dir + "/dictionaries")
|
||||
|
||||
base.copy_dir(git_dir + "/desktop-apps/common/package/fonts", root_dir + "/fonts")
|
||||
base.copy_file(git_dir + "/desktop-apps/common/package/license/3dparty/3DPARTYLICENSE", root_dir + "/3DPARTYLICENSE")
|
||||
|
||||
@ -95,6 +95,7 @@ def make():
|
||||
if ("ios" == platform):
|
||||
base.generate_plist(root_dir)
|
||||
deploy_fonts(git_dir, root_dir)
|
||||
base.copy_dictionaries(git_dir + "/dictionaries", root_dir + "/dictionaries", True, False)
|
||||
|
||||
if (0 == platform.find("mac")):
|
||||
base.mac_correct_rpath_x2t(root_dir)
|
||||
@ -110,6 +111,7 @@ def make():
|
||||
base.copy_dir(base_dir + "/js/" + branding + "/mobile/sdkjs", root_dir + "/sdkjs")
|
||||
# fonts
|
||||
deploy_fonts(git_dir, root_dir, "android")
|
||||
base.copy_dictionaries(git_dir + "/dictionaries", root_dir + "/dictionaries", True, False)
|
||||
# app
|
||||
base.generate_doctrenderer_config(root_dir + "/DoctRenderer.config", "./", "builder")
|
||||
libs_dir = root_dir + "/lib"
|
||||
|
||||
@ -58,7 +58,6 @@ def make():
|
||||
base.create_dir(build_server_dir + '/Metrics/node_modules/modern-syslog/build/Release')
|
||||
base.copy_file(bin_server_dir + "/Metrics/node_modules/modern-syslog/build/Release/core.node", build_server_dir + "/Metrics/node_modules/modern-syslog/build/Release/core.node")
|
||||
|
||||
|
||||
qt_dir = base.qt_setup(native_platform)
|
||||
platform = native_platform
|
||||
|
||||
@ -147,10 +146,7 @@ def make():
|
||||
branding_dir = git_dir + '/' + config.option("branding") + '/server'
|
||||
|
||||
#dictionaries
|
||||
spellchecker_dictionaries = root_dir + '/dictionaries'
|
||||
spellchecker_dictionaries_files = server_dir + '/../dictionaries/*_*'
|
||||
base.create_dir(spellchecker_dictionaries)
|
||||
base.copy_files(spellchecker_dictionaries_files, spellchecker_dictionaries)
|
||||
base.copy_dictionaries(server_dir + "/../dictionaries", root_dir + "/dictionaries")
|
||||
|
||||
if (0 == platform.find("win")):
|
||||
exec_ext = '.exe'
|
||||
|
||||
Reference in New Issue
Block a user