Index: make.py ================================================================== --- make.py +++ make.py @@ -18,10 +18,11 @@ from distutils import dir_util, file_util import dialog_bundled import compile_rules import helpers +import lex_build sWarningMessage = "The content of this folder is generated by code and replaced at each build.\n" @@ -301,15 +302,22 @@ if not os.path.isdir("graphspell-js/"+sf): file_util.copy_file("graphspell-js/"+sf, "grammalecte-js/graphspell") helpers.copyAndFileTemplate("graphspell-js/"+sf, "grammalecte-js/graphspell/"+sf, dVars) -def copyGraphspellDictionary (sDicName, bJavaScript=False): - file_util.copy_file("graphspell/_dictionaries/"+sDicName.strip()+".bdic", "grammalecte/graphspell/_dictionaries") - file_util.copy_file("graphspell/_dictionaries/"+sDicName.strip()+".info.txt", "grammalecte/graphspell/_dictionaries") +def copyGraphspellDictionary (dVars, bJavaScript=False): + spfDic = "graphspell/_dictionaries/"+dVars['dic_name']+".bdic" + if not os.path.isfile(spfDic): + buildDictionary(dVars, bJavaScript) + file_util.copy_file(spfDic, "grammalecte/graphspell/_dictionaries") + file_util.copy_file(spfDic[:-5]+".info.txt", "grammalecte/graphspell/_dictionaries") if bJavaScript: - file_util.copy_file("graphspell-js/_dictionaries/"+sDicName.strip()+".json", "grammalecte-js/graphspell/_dictionaries") + file_util.copy_file(spfDic[:-5]+".json", "grammalecte-js/graphspell/_dictionaries") + + +def buildDictionary (dVars, bJavaScript): + lex_build.build(dVars['lexicon_src'], dVars['lang_name'], dVars['dic_name'], bJavaScript, dVars['stemming_method'], int(dVars['fsa_method'])) def main (): print("Python: " + sys.version) xParser = argparse.ArgumentParser() @@ -353,18 +361,16 @@ except ImportError: print("# Error. Couldn’t import file build_data.py in folder gc_lang/"+sLang) if build_data_module and xArgs.build_data_before: build_data_module.before('gc_lang/'+sLang, dVars, xArgs.javascript) if xArgs.dict: - import lex_build - lex_build.build(dVars['lexicon_src'], dVars['lang_name'], dVars['dic_name'], xArgs.javascript, dVars['stemming_method'], int(dVars['fsa_method'])) + buildDictionary(dVars, xArgs.javascript) if build_data_module and xArgs.build_data_after: build_data_module.after('gc_lang/'+sLang, dVars, xArgs.javascript) # copy dictionaries from Graphspell - for sDicName in dVars['dic_name'].split(","): - copyGraphspellDictionary(sDicName, xArgs.javascript) + copyGraphspellDictionary(dVars, xArgs.javascript) # make sVersion = create(sLang, xConfig, xArgs.install, xArgs.javascript, ) # tests