ADDED gc_lang/fr/build.py Index: gc_lang/fr/build.py ================================================================== --- gc_lang/fr/build.py +++ gc_lang/fr/build.py @@ -0,0 +1,95 @@ +# Builder for French language + +import os +import zipfile +from distutils import dir_util, file_util + +import helpers + + +def build (sLang, dVars, spLangPack): + "complementary build launched from make.py" + createFirefoxExtension(sLang, dVars) + createThunderbirdExtension(sLang, dVars, spLangPack) + + +def createFirefoxExtension (sLang, dVars): + "create extension for Firefox" + print("Building extension for Firefox") + helpers.createCleanFolder("_build/xpi/"+sLang) + dir_util.copy_tree("gc_lang/"+sLang+"/xpi/", "_build/xpi/"+sLang) + dir_util.copy_tree("grammalecte-js", "_build/xpi/"+sLang+"/grammalecte") + sHTML, dProperties = _createOptionsForFirefox(dVars) + dVars['optionsHTML'] = sHTML + helpers.copyAndFileTemplate("_build/xpi/"+sLang+"/data/about_panel.html", "_build/xpi/"+sLang+"/data/about_panel.html", dVars) + for sLocale in dProperties.keys(): + spfLocale = "_build/xpi/"+sLang+"/locale/"+sLocale+".properties" + if os.path.exists(spfLocale): + helpers.copyAndFileTemplate(spfLocale, spfLocale, dProperties) + else: + print("Locale file not found: " + spfLocale) + with helpers.cd("_build/xpi/"+sLang): + os.system("jpm xpi") + + +def _createOptionsForFirefox (dVars): + sHTML = "" + for sSection, lOpt in dVars['lStructOpt']: + sHTML += '\n
\n

\n' + for lLineOpt in lOpt: + for sOpt in lLineOpt: + sHTML += '

\n' + sHTML += '
\n' + # Creating translation data + dProperties = {} + for sLang in dVars['dOptLabel'].keys(): + dProperties[sLang] = "\n".join( [ "option_" + sOpt + " = " + dVars['dOptLabel'][sLang][sOpt][0].replace(" [!]", " [!]") for sOpt in dVars['dOptLabel'][sLang] ] ) + return sHTML, dProperties + + +def createThunderbirdExtension (sLang, dVars, spLangPack): + "create extension for Thunderbird" + print("Building extension for Thunderbird") + sExtensionName = dVars['tb_identifier'] + "-v" + dVars['version'] + '.xpi' + spfZip = "_build/" + sExtensionName + hZip = zipfile.ZipFile(spfZip, mode='w', compression=zipfile.ZIP_DEFLATED) + _copyGrammalecteJSPackageInZipFile(hZip, spLangPack, dVars['js_binary_dic']) + for spf in ["LICENSE.txt", "LICENSE.fr.txt"]: + hZip.write(spf) + dVars = _createOptionsForThunderbird(dVars) + helpers.addFolderToZipAndFileFile(hZip, "gc_lang/"+sLang+"/tb", "", dVars, True) + hZip.write("gc_lang/"+sLang+"/xpi/gce_worker.js", "worker/gce_worker.js") + spDict = "gc_lang/"+sLang+"/xpi/data/dictionaries" + for sp in os.listdir(spDict): + if os.path.isdir(spDict+"/"+sp): + hZip.write(spDict+"/"+sp+"/"+sp+".dic", "content/dictionaries/"+sp+"/"+sp+".dic") + hZip.write(spDict+"/"+sp+"/"+sp+".aff", "content/dictionaries/"+sp+"/"+sp+".aff") + hZip.close() + helpers.unzip(spfZip, dVars['tb_debug_extension_path']) + + +def _createOptionsForThunderbird (dVars): + dVars['sXULTabs'] = "" + dVars['sXULTabPanels'] = "" + # dialog options + for sSection, lOpt in dVars['lStructOpt']: + dVars['sXULTabs'] += ' \n' + dVars['sXULTabPanels'] += ' \n \n' + # translation data + for sLang in dVars['dOptLabel'].keys(): + dVars['gc_options_labels_'+sLang] = "\n".join( [ "' for sOpt in dVars['dOptLabel'][sLang] ] ) + return dVars + + +def _copyGrammalecteJSPackageInZipFile (hZip, spLangPack, sDicName, sAddPath=""): + for sf in os.listdir("grammalecte-js"): + if not os.path.isdir("grammalecte-js/"+sf): + hZip.write("grammalecte-js/"+sf, sAddPath+"grammalecte-js/"+sf) + for sf in os.listdir(spLangPack): + if not os.path.isdir(spLangPack+"/"+sf): + hZip.write(spLangPack+"/"+sf, sAddPath+spLangPack+"/"+sf) + hZip.write("grammalecte-js/_dictionaries/"+sDicName, sAddPath+"grammalecte-js/_dictionaries/"+sDicName) ADDED helpers.py Index: helpers.py ================================================================== --- helpers.py +++ helpers.py @@ -0,0 +1,89 @@ +# Useful tools + +import os +import zipfile + +from distutils import dir_util, file_util +from string import Template + + +class cd: + "Context manager for changing the current working directory" + def __init__ (self, newPath): + self.newPath = os.path.expanduser(newPath) + + def __enter__ (self): + self.savedPath = os.getcwd() + os.chdir(self.newPath) + + def __exit__ (self, etype, value, traceback): + os.chdir(self.savedPath) + + +def unzip (spfZip, spDest, bCreatePath=False): + "unzip file at " + if spDest: + if bCreatePath and not os.path.exists(spDest): + dir_util.mkpath(spDest) + print("> unzip in: "+ spDest) + spInstall = os.path.abspath(spDest) + if os.path.isdir(spInstall): + eraseFolder(spInstall) + with zipfile.ZipFile(spfZip) as hZip: + hZip.extractall(spDest) + else: + print("# folder not found") + else: + print("path destination is empty") + + +def eraseFolder (sp): + "erase content of a folder" + # recursive!!! + for sf in os.listdir(sp): + spf = sp + "/" + sf + if os.path.isdir(spf): + eraseFolder(spf) + else: + try: + os.remove(spf) + except: + print("%s not removed" % spf) + + +def createCleanFolder (sp): + "make an empty folder or erase its content if not empty" + if not os.path.exists(sp): + dir_util.mkpath(sp) + else: + eraseFolder(sp) + + +def fileFile (spf, dVars): + "return file as a text filed with variables from " + return Template(open(spf, "r", encoding="utf-8").read()).safe_substitute(dVars) + + +def copyAndFileTemplate (spfSrc, spfDst, dVars): + "write file as with variables filed with " + s = Template(open(spfSrc, "r", encoding="utf-8").read()).safe_substitute(dVars) + open(spfDst, "w", encoding="utf-8", newline="\n").write(s) + + +def addFolderToZipAndFileFile (hZip, spSrc, spDst, dVars, bRecursive): + # recursive function + spSrc = spSrc.strip("/ ") + spDst = spDst.strip("/ ") + for sf in os.listdir(spSrc): + spfSrc = (spSrc + "/" + sf).strip("/ ") + spfDst = (spDst + "/" + sf).strip("/ ") + if os.path.isdir(spfSrc): + if bRecursive: + addFolderToZipAndFileFile(hZip, spfSrc, spfDst, dVars, bRecursive) + else: + if spfSrc.endswith((".css", ".js", ".xcu", ".xul", ".rdf", ".dtd", ".properties")): + #print(spfSrc + " > " + spfDst) + hZip.writestr(spfDst, fileFile(spfSrc, dVars)) + else: + #print(spfSrc + " > " + spfDst) + hZip.write(spfSrc, spfDst) Index: make.py ================================================================== --- make.py +++ make.py @@ -12,96 +12,19 @@ import argparse import importlib import unittest import json -from string import Template from distutils import dir_util, file_util import dialog_bundled import compile_rules +import helpers sWarningMessage = "The content of this folder is generated by code and replaced at each build.\n" - -class cd: - """Context manager for changing the current working directory""" - def __init__ (self, newPath): - self.newPath = os.path.expanduser(newPath) - - def __enter__ (self): - self.savedPath = os.getcwd() - os.chdir(self.newPath) - - def __exit__ (self, etype, value, traceback): - os.chdir(self.savedPath) - - -def fileFile (spf, dVars): - return Template(open(spf, "r", encoding="utf-8").read()).safe_substitute(dVars) - - -def copyAndFileTemplate (spfSrc, spfDst, dVars): - s = Template(open(spfSrc, "r", encoding="utf-8").read()).safe_substitute(dVars) - open(spfDst, "w", encoding="utf-8", newline="\n").write(s) - - -def addFolderToZipAndFileFile (hZip, spSrc, spDst, dVars, bRecursive): - # recursive function - spSrc = spSrc.strip("/ ") - spDst = spDst.strip("/ ") - for sf in os.listdir(spSrc): - spfSrc = (spSrc + "/" + sf).strip("/ ") - spfDst = (spDst + "/" + sf).strip("/ ") - if os.path.isdir(spfSrc): - if bRecursive: - addFolderToZipAndFileFile(hZip, spfSrc, spfDst, dVars, bRecursive) - else: - if spfSrc.endswith((".css", ".js", ".xcu", ".xul", ".rdf", ".dtd", ".properties")): - #print(spfSrc + " > " + spfDst) - hZip.writestr(spfDst, fileFile(spfSrc, dVars)) - else: - #print(spfSrc + " > " + spfDst) - hZip.write(spfSrc, spfDst) - - -def unzip (spfZip, spDest, bCreatePath=False): - if spDest: - if bCreatePath and not os.path.exists(spDest): - dir_util.mkpath(spDest) - print("> unzip in: "+ spDest) - spInstall = os.path.abspath(spDest) - if os.path.isdir(spInstall): - eraseFolder(spInstall) - with zipfile.ZipFile(spfZip) as hZip: - hZip.extractall(spDest) - else: - print("# folder not found") - else: - print("path destination is empty") - - -def eraseFolder (sp): - # recursive!!! - for sf in os.listdir(sp): - spf = sp + "/" + sf - if os.path.isdir(spf): - eraseFolder(spf) - else: - try: - os.remove(spf) - except: - print("%s not removed" % spf) - - -def createCleanFolder (sp): - if not os.path.exists(sp): - dir_util.mkpath(sp) - else: - eraseFolder(sp) - def getConfig (sLang): xConfig = configparser.SafeConfigParser() xConfig.optionxform = str try: @@ -155,37 +78,37 @@ # Package and parser copyGrammalectePyPackageInZipFile(hZip, spLangPack, dVars['py_binary_dic'], "pythonpath/") hZip.write("cli.py", "pythonpath/cli.py") # Extension files - hZip.writestr("META-INF/manifest.xml", fileFile("gc_core/py/oxt/manifest.xml", dVars)) - hZip.writestr("description.xml", fileFile("gc_core/py/oxt/description.xml", dVars)) - hZip.writestr("Linguistic.xcu", fileFile("gc_core/py/oxt/Linguistic.xcu", dVars)) - hZip.writestr("Grammalecte.py", fileFile("gc_core/py/oxt/Grammalecte.py", dVars)) + hZip.writestr("META-INF/manifest.xml", helpers.fileFile("gc_core/py/oxt/manifest.xml", dVars)) + hZip.writestr("description.xml", helpers.fileFile("gc_core/py/oxt/description.xml", dVars)) + hZip.writestr("Linguistic.xcu", helpers.fileFile("gc_core/py/oxt/Linguistic.xcu", dVars)) + hZip.writestr("Grammalecte.py", helpers.fileFile("gc_core/py/oxt/Grammalecte.py", dVars)) for sf in dVars["extras"].split(","): - hZip.writestr(sf.strip(), fileFile(spLang + '/' + sf.strip(), dVars)) + hZip.writestr(sf.strip(), helpers.fileFile(spLang + '/' + sf.strip(), dVars)) if "logo" in dVars.keys() and dVars["logo"].strip(): hZip.write(spLang + '/' + dVars["logo"].strip(), dVars["logo"].strip()) ## OPTIONS # options dialog within LO/OO options panel (legacy) - #hZip.writestr("pythonpath/lightproof_handler_grammalecte.py", fileFile("gc_core/py/oxt/lightproof_handler_grammalecte.py", dVars)) + #hZip.writestr("pythonpath/lightproof_handler_grammalecte.py", helpers.fileFile("gc_core/py/oxt/lightproof_handler_grammalecte.py", dVars)) #lLineOptions = open(spLang + "/options.txt", "r", encoding="utf-8").readlines() #dialog_bundled.c(dVars["implname"], lLineOptions, hZip, dVars["lang"]) # options dialog - hZip.writestr("pythonpath/Options.py", fileFile("gc_core/py/oxt/Options.py", dVars)) + hZip.writestr("pythonpath/Options.py", helpers.fileFile("gc_core/py/oxt/Options.py", dVars)) hZip.write("gc_core/py/oxt/op_strings.py", "pythonpath/op_strings.py") # options dialog within Writer options panel dVars["xdl_dialog_options"] = createDialogOptionsXDL(dVars) dVars["xcs_options"] = "\n".join([ '' for sOpt in dVars["dOptPython"] ]) dVars["xcu_label_values"] = "\n".join([ '' + dVars["dOptLabel"][sLang]["__optiontitle__"] + '' for sLang in dVars["dOptLabel"] ]) - hZip.writestr("dialog/options_page.xdl", fileFile("gc_core/py/oxt/options_page.xdl", dVars)) - hZip.writestr("dialog/OptionsDialog.xcs", fileFile("gc_core/py/oxt/OptionsDialog.xcs", dVars)) - hZip.writestr("dialog/OptionsDialog.xcu", fileFile("gc_core/py/oxt/OptionsDialog.xcu", dVars)) + hZip.writestr("dialog/options_page.xdl", helpers.fileFile("gc_core/py/oxt/options_page.xdl", dVars)) + hZip.writestr("dialog/OptionsDialog.xcs", helpers.fileFile("gc_core/py/oxt/OptionsDialog.xcs", dVars)) + hZip.writestr("dialog/OptionsDialog.xcu", helpers.fileFile("gc_core/py/oxt/OptionsDialog.xcu", dVars)) hZip.writestr("dialog/" + dVars['lang'] + "_en.default", "") for sLangLbl, dOptLbl in dVars['dOptLabel'].items(): hZip.writestr("dialog/" + dVars['lang'] + "_" + sLangLbl + ".properties", createOptionsLabelProperties(dOptLbl)) ## ADDONS OXT @@ -195,11 +118,11 @@ if os.path.isdir(spLang+'/'+spfSrc): for sf in os.listdir(spLang+'/'+spfSrc): hZip.write(spLang+'/'+spfSrc+"/"+sf, spfDst+"/"+sf) else: if spfSrc.endswith(('.txt', '.py')): - hZip.writestr(spfDst, fileFile(spLang+'/'+spfSrc, dVars)) + hZip.writestr(spfDst, helpers.fileFile(spLang+'/'+spfSrc, dVars)) else: hZip.write(spLang+'/'+spfSrc, spfDst) print() hZip.close() @@ -212,82 +135,10 @@ #subprocess.run(cmd) os.system(cmd) else: print("# Error: path and filename of unopkg not set in config.ini") - -def createOptionsForFirefox (dVars): - sHTML = "" - for sSection, lOpt in dVars['lStructOpt']: - sHTML += '\n
\n

\n' - for lLineOpt in lOpt: - for sOpt in lLineOpt: - sHTML += '

\n' - sHTML += '
\n' - # Creating translation data - dProperties = {} - for sLang in dVars['dOptLabel'].keys(): - dProperties[sLang] = "\n".join( [ "option_" + sOpt + " = " + dVars['dOptLabel'][sLang][sOpt][0].replace(" [!]", " [!]") for sOpt in dVars['dOptLabel'][sLang] ] ) - return sHTML, dProperties - - -def createFirefoxExtension (sLang, dVars): - "create extension for Firefox" - print("Building extension for Firefox") - createCleanFolder("_build/xpi/"+sLang) - dir_util.copy_tree("gc_lang/"+sLang+"/xpi/", "_build/xpi/"+sLang) - dir_util.copy_tree("grammalecte-js", "_build/xpi/"+sLang+"/grammalecte") - sHTML, dProperties = createOptionsForFirefox(dVars) - dVars['optionsHTML'] = sHTML - copyAndFileTemplate("_build/xpi/"+sLang+"/data/about_panel.html", "_build/xpi/"+sLang+"/data/about_panel.html", dVars) - for sLocale in dProperties.keys(): - spfLocale = "_build/xpi/"+sLang+"/locale/"+sLocale+".properties" - if os.path.exists(spfLocale): - copyAndFileTemplate(spfLocale, spfLocale, dProperties) - else: - print("Locale file not found: " + spfLocale) - with cd("_build/xpi/"+sLang): - os.system("jpm xpi") - - -def createOptionsForThunderbird (dVars): - dVars['sXULTabs'] = "" - dVars['sXULTabPanels'] = "" - # dialog options - for sSection, lOpt in dVars['lStructOpt']: - dVars['sXULTabs'] += ' \n' - dVars['sXULTabPanels'] += ' \n \n' - # translation data - for sLang in dVars['dOptLabel'].keys(): - dVars['gc_options_labels_'+sLang] = "\n".join( [ "' for sOpt in dVars['dOptLabel'][sLang] ] ) - return dVars - - -def createThunderbirdExtension (sLang, dVars, spLangPack): - "create extension for Thunderbird" - print("Building extension for Thunderbird") - sExtensionName = dVars['tb_identifier'] + "-v" + dVars['version'] + '.xpi' - spfZip = "_build/" + sExtensionName - hZip = zipfile.ZipFile(spfZip, mode='w', compression=zipfile.ZIP_DEFLATED) - copyGrammalecteJSPackageInZipFile(hZip, spLangPack, dVars['js_binary_dic']) - for spf in ["LICENSE.txt", "LICENSE.fr.txt"]: - hZip.write(spf) - dVars = createOptionsForThunderbird(dVars) - addFolderToZipAndFileFile(hZip, "gc_lang/"+sLang+"/tb", "", dVars, True) - hZip.write("gc_lang/"+sLang+"/xpi/gce_worker.js", "worker/gce_worker.js") - spDict = "gc_lang/"+sLang+"/xpi/data/dictionaries" - for sp in os.listdir(spDict): - if os.path.isdir(spDict+"/"+sp): - hZip.write(spDict+"/"+sp+"/"+sp+".dic", "content/dictionaries/"+sp+"/"+sp+".dic") - hZip.write(spDict+"/"+sp+"/"+sp+".aff", "content/dictionaries/"+sp+"/"+sp+".aff") - hZip.close() - unzip(spfZip, dVars['tb_debug_extension_path']) - def createServerOptions (sLang, dOptData): with open("server_options."+sLang+".ini", "w", encoding="utf-8", newline="\n") as hDst: hDst.write("# Server options. Lang: " + sLang + "\n\n[gc_options]\n") for sSection, lOpt in dOptData["lStructOpt"]: @@ -305,11 +156,11 @@ hZip = zipfile.ZipFile(spfZip, mode='w', compression=zipfile.ZIP_DEFLATED) copyGrammalectePyPackageInZipFile(hZip, spLangPack, dVars['py_binary_dic']) for spf in ["cli.py", "server.py", "bottle.py", "server_options._global.ini", "server_options."+sLang+".ini", \ "README.txt", "LICENSE.txt", "LICENSE.fr.txt"]: hZip.write(spf) - hZip.writestr("setup.py", fileFile("gc_lang/fr/setup.py", dVars)) + hZip.writestr("setup.py", helpers.fileFile("gc_lang/fr/setup.py", dVars)) def copyGrammalectePyPackageInZipFile (hZip, spLangPack, sDicName, sAddPath=""): for sf in os.listdir("grammalecte"): if not os.path.isdir("grammalecte/"+sf): @@ -317,20 +168,10 @@ for sf in os.listdir(spLangPack): if not os.path.isdir(spLangPack+"/"+sf): hZip.write(spLangPack+"/"+sf, sAddPath+spLangPack+"/"+sf) hZip.write("grammalecte/_dictionaries/"+sDicName, sAddPath+"grammalecte/_dictionaries/"+sDicName) - -def copyGrammalecteJSPackageInZipFile (hZip, spLangPack, sDicName, sAddPath=""): - for sf in os.listdir("grammalecte-js"): - if not os.path.isdir("grammalecte-js/"+sf): - hZip.write("grammalecte-js/"+sf, sAddPath+"grammalecte-js/"+sf) - for sf in os.listdir(spLangPack): - if not os.path.isdir(spLangPack+"/"+sf): - hZip.write(spLangPack+"/"+sf, sAddPath+spLangPack+"/"+sf) - hZip.write("grammalecte-js/_dictionaries/"+sDicName, sAddPath+"grammalecte-js/_dictionaries/"+sDicName) - def create (sLang, xConfig, bInstallOXT, bJavaScript): oNow = datetime.datetime.now() print("============== MAKE GRAMMALECTE [{0}] at {1.hour:>2} h {1.minute:>2} min {1.second:>2} s ==============".format(sLang, oNow)) @@ -362,14 +203,14 @@ print() dVars["plugins"] = sCodePlugins ## CREATE GRAMMAR CHECKER PACKAGE spLangPack = "grammalecte/"+sLang - createCleanFolder(spLangPack) + helpers.createCleanFolder(spLangPack) for sf in os.listdir("gc_core/py/lang_core"): if not os.path.isdir("gc_core/py/lang_core/"+sf): - copyAndFileTemplate("gc_core/py/lang_core/"+sf, spLangPack+"/"+sf, dVars) + helpers.copyAndFileTemplate("gc_core/py/lang_core/"+sf, spLangPack+"/"+sf, dVars) print("+ Modules: ", end="") for sf in os.listdir(spLang+"/modules"): if not sf.startswith("gce_"): file_util.copy_file(spLang+"/modules/"+sf, spLangPack) print(sf, end=", ") @@ -400,32 +241,37 @@ # options data struct dVars["dOptJavaScript"] = json.dumps(list(dVars["dOptJavaScript"].items())) # create folder spLangPack = "grammalecte-js/"+sLang - createCleanFolder(spLangPack) + helpers.createCleanFolder(spLangPack) # create files for sf in os.listdir("gc_core/js"): if not os.path.isdir("gc_core/js/"+sf) and sf.startswith("jsex_"): dVars[sf[5:-3]] = open("gc_core/js/"+sf, "r", encoding="utf-8").read() for sf in os.listdir("gc_core/js"): if not os.path.isdir("gc_core/js/"+sf) and not sf.startswith("jsex_"): - copyAndFileTemplate("gc_core/js/"+sf, "grammalecte-js/"+sf, dVars) + helpers.copyAndFileTemplate("gc_core/js/"+sf, "grammalecte-js/"+sf, dVars) open("grammalecte-js/WARNING.txt", "w", encoding="utf-8", newline="\n").write(sWarningMessage) for sf in os.listdir("gc_core/js/lang_core"): if not os.path.isdir("gc_core/js/lang_core/"+sf) and sf.startswith("gc_"): - copyAndFileTemplate("gc_core/js/lang_core/"+sf, spLangPack+"/"+sf, dVars) + helpers.copyAndFileTemplate("gc_core/js/lang_core/"+sf, spLangPack+"/"+sf, dVars) print("+ Modules: ", end="") for sf in os.listdir(spLang+"/modules-js"): if not sf.startswith("gce_"): - copyAndFileTemplate(spLang+"/modules-js/"+sf, spLangPack+"/"+sf, dVars) + helpers.copyAndFileTemplate(spLang+"/modules-js/"+sf, spLangPack+"/"+sf, dVars) print(sf, end=", ") print() - createFirefoxExtension(sLang, dVars) - createThunderbirdExtension(sLang, dVars, spLangPack) + build_module = None + try: + build_module = importlib.import_module("gc_lang."+sLang+".build") + except ImportError: + print("# No complementary builder in folder gc_lang/"+sLang) + if build_module: + build_module.build(sLang, dVars, spLangPack) return dVars['version'] def main (): @@ -453,23 +299,23 @@ dVars = xConfig._sections['args'] # copy gc_core common file in Python now to be able to compile dictionary if required for sf in os.listdir("gc_core/py"): if not os.path.isdir("gc_core/py/"+sf): - copyAndFileTemplate("gc_core/py/"+sf, "grammalecte/"+sf, dVars) + helpers.copyAndFileTemplate("gc_core/py/"+sf, "grammalecte/"+sf, dVars) open("grammalecte/WARNING.txt", "w", encoding="utf-8", newline="\n").write(sWarningMessage) # build data - build_module = None + build_data_module = None if xArgs.build_data: # lang data try: - build_module = importlib.import_module("gc_lang."+sLang+".build_data") + build_data_module = importlib.import_module("gc_lang."+sLang+".build_data") except ImportError: print("# Error. Couldn’t import file build_data.py in folder gc_lang/"+sLang) - if build_module: - build_module.before('gc_lang/'+sLang, dVars, xArgs.javascript) + if build_data_module: + build_data_module.before('gc_lang/'+sLang, dVars, xArgs.javascript) if xArgs.dict or not os.path.exists("grammalecte/_dictionaries"): import grammalecte.dawg as fsa from grammalecte.ibdawg import IBDAWG # fsa builder oDAWG = fsa.DAWG(dVars['lexicon_src'], dVars['lang_name'], dVars['stemming_method']) @@ -479,12 +325,12 @@ if xArgs.javascript: dir_util.mkpath("grammalecte-js/_dictionaries") oDic = IBDAWG(dVars['py_binary_dic']) #oDic.writeAsJSObject("gc_lang/"+sLang+"/modules-js/dictionary.js") oDic.writeAsJSObject("grammalecte-js/_dictionaries/"+dVars['js_binary_dic']) - if build_module: - build_module.after('gc_lang/'+sLang, dVars, xArgs.javascript) + if build_data_module: + build_data_module.after('gc_lang/'+sLang, dVars, xArgs.javascript) # make sVersion = create(sLang, xConfig, xArgs.install, xArgs.javascript, ) # tests @@ -503,11 +349,11 @@ hDst = open("./gc_lang/"+sLang+"/perf_memo.txt", "a", encoding="utf-8", newline="\n") if xArgs.perf_memo else None tests.perf(sVersion, hDst) # Firefox if xArgs.firefox: - with cd("_build/xpi/"+sLang): + with helpers.cd("_build/xpi/"+sLang): os.system("jpm run -b nightly") # Thunderbird if xArgs.thunderbird: os.system("thunderbird -jsconsole -P debug")