Index: gc_lang/fr/build.py ================================================================== --- gc_lang/fr/build.py +++ gc_lang/fr/build.py @@ -37,11 +37,11 @@ sHTML += '\n' return sHTML def createFirefoxExtension (sLang, dVars): - "create extension for Firefox" + "create extension for Firefox (obsolete)" 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) @@ -56,10 +56,11 @@ with helpers.cd("_build/xpi/"+sLang): os.system("jpm xpi") def _createOptionsForFirefox (dVars): + # obsolete sHTML = "" for sSection, lOpt in dVars['lStructOpt']: sHTML += '\n
\n

\n' for lLineOpt in lOpt: for sOpt in lLineOpt: @@ -112,9 +113,12 @@ 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("grammalecte-js/graphspell"): + if not os.path.isdir("grammalecte-js/graphspell/"+sf): + hZip.write("grammalecte-js/graphspell/"+sf, sAddPath+"grammalecte-js/graphspell/"+sf) + hZip.write("grammalecte-js/graphspell/_dictionaries/"+sDicName, sAddPath+"grammalecte-js/graphspell/_dictionaries/"+sDicName) 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) Index: make.py ================================================================== --- make.py +++ make.py @@ -206,10 +206,16 @@ sCodePlugins += "\n\n" + open(spLang+'/modules/'+sf, "r", encoding="utf-8").read() print(sf, end=", ") print() dVars["plugins"] = sCodePlugins + ## COPY GC_CORE COMMON FILES + for sf in os.listdir("gc_core/py"): + if not os.path.isdir("gc_core/py/"+sf): + helpers.copyAndFileTemplate("gc_core/py/"+sf, "grammalecte/"+sf, dVars) + open("grammalecte/WARNING.txt", "w", encoding="utf-8", newline="\n").write(sWarningMessage) + ## CREATE GRAMMAR CHECKER PACKAGE spLangPack = "grammalecte/"+sLang helpers.createCleanFolder(spLangPack) for sf in os.listdir("gc_core/py/lang_core"): if not os.path.isdir("gc_core/py/lang_core/"+sf): @@ -278,27 +284,29 @@ build_module.build(sLang, dVars, spLangPack) return dVars['version'] -def copyGraphspellCore (): +def copyGraphspellCore (bJavaScript=False): helpers.createCleanFolder("grammalecte/graphspell") - helpers.createCleanFolder("grammalecte-js/graphspell") dir_util.mkpath("grammalecte/graphspell/_dictionaries") - dir_util.mkpath("grammalecte-js/graphspell/_dictionaries") for sf in os.listdir("graphspell"): if not os.path.isdir("graphspell/"+sf): file_util.copy_file("graphspell/"+sf, "grammalecte/graphspell") - for sf in os.listdir("graphspell-js"): - if not os.path.isdir("graphspell-js/"+sf): - file_util.copy_file("graphspell-js/"+sf, "grammalecte-js/graphspell") + if bJavaScript: + helpers.createCleanFolder("grammalecte-js/graphspell") + dir_util.mkpath("grammalecte-js/graphspell/_dictionaries") + for sf in os.listdir("graphspell-js"): + if not os.path.isdir("graphspell-js/"+sf): + file_util.copy_file("graphspell-js/"+sf, "grammalecte-js/graphspell") -def copyGraphspellDictionary (sDicName): +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") - file_util.copy_file("graphspell-js/_dictionaries/"+sDicName.strip()+".json", "grammalecte-js/graphspell/_dictionaries") + if bJavaScript: + file_util.copy_file("graphspell-js/_dictionaries/"+sDicName.strip()+".json", "grammalecte-js/graphspell/_dictionaries") def main (): print("Python: " + sys.version) xParser = argparse.ArgumentParser() @@ -321,25 +329,20 @@ xArgs.build_data_before = True xArgs.build_data_after = True dir_util.mkpath("_build") dir_util.mkpath("grammalecte") - dir_util.mkpath("grammalecte-js") + if xArgs.javascript: + dir_util.mkpath("grammalecte-js") - copyGraphspellCore() + copyGraphspellCore(xArgs.javascript) for sLang in xArgs.lang: if os.path.exists("gc_lang/"+sLang) and os.path.isdir("gc_lang/"+sLang): xConfig = getConfig(sLang) 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): - helpers.copyAndFileTemplate("gc_core/py/"+sf, "grammalecte/"+sf, dVars) - open("grammalecte/WARNING.txt", "w", encoding="utf-8", newline="\n").write(sWarningMessage) - # build data build_data_module = None if xArgs.build_data_before or xArgs.build_data_after: # lang data try: @@ -354,11 +357,11 @@ 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) + copyGraphspellDictionary(sDicName, xArgs.javascript) # make sVersion = create(sLang, xConfig, xArgs.install, xArgs.javascript, ) # tests