Index: gc_lang/fr/build.py ================================================================== --- gc_lang/fr/build.py +++ gc_lang/fr/build.py @@ -4,11 +4,10 @@ import platform import zipfile import shutil import json import traceback -from distutils import dir_util, file_util import helpers def build (sLang, dVars): @@ -22,12 +21,12 @@ def createWebExtension (sLang, dVars): "create Web-extension" print("> Building WebExtension for Firefox") helpers.createCleanFolder("_build/webext/"+sLang) - dir_util.copy_tree("gc_lang/"+sLang+"/webext/", "_build/webext/"+sLang) - dir_util.copy_tree("grammalecte-js", "_build/webext/"+sLang+"/grammalecte") + shutil.copytree("gc_lang/"+sLang+"/webext/", "_build/webext/"+sLang, dirs_exist_ok=True) + shutil.copytree("grammalecte-js", "_build/webext/"+sLang+"/grammalecte", dirs_exist_ok=True) helpers.copyAndFileTemplate("_build/webext/"+sLang+"/manifest.json", "_build/webext/"+sLang+"/manifest.json", dVars) helpers.copyAndFileTemplate("_build/webext/"+sLang+"/panel/main.html", "_build/webext/"+sLang+"/panel/main.html", dVars) with helpers.CD("_build/webext/"+sLang): os.system("web-ext build") # Copy Firefox zip extension to _build @@ -87,15 +86,15 @@ # Note about copying Thunderbird extension directly into the profile: # In Options > Configuration editor (about:config), deactivate option # If is changed, you must reinstall the extension manually spExtension = dVars['win_tb_debug_extension_path'] if platform.system() == "Windows" else dVars['linux_tb_debug_extension_path'] if os.path.isdir(spExtension): - file_util.copy_file(spfZip, f"{spExtension}/{dVars['tb_identifier']}.xpi") # Filename for TB is just + shutil.copy2(spfZip, f"{spExtension}/{dVars['tb_identifier']}.xpi") # Filename for TB is just print(f"Thunderbird extension copied in <{spExtension}>") spExtension = dVars['win_tb_beta_extension_path'] if platform.system() == "Windows" else dVars['linux_tb_beta_extension_path'] if os.path.isdir(spExtension): - file_util.copy_file(spfZip, f"{spExtension}/{dVars['tb_identifier']}.xpi") # Filename for TB is just + shutil.copy2(spfZip, f"{spExtension}/{dVars['tb_identifier']}.xpi") # Filename for TB is just print(f"Thunderbird extension copied in <{spExtension}>") def _copyGrammalecteJSPackageInZipFile (hZip, sLang, sAddPath=""): for sf in os.listdir("grammalecte-js"): @@ -112,7 +111,7 @@ hZip.write("grammalecte-js/"+sLang+"/"+sf, sAddPath+"grammalecte/"+sLang+"/"+sf) def createNodeJSPackage (sLang): helpers.createCleanFolder("_build/nodejs/"+sLang) - dir_util.copy_tree("gc_lang/"+sLang+"/nodejs/", "_build/nodejs/"+sLang) - dir_util.copy_tree("grammalecte-js", "_build/nodejs/"+sLang+"/core/grammalecte") + shutil.copytree("gc_lang/"+sLang+"/nodejs/", "_build/nodejs/"+sLang, dirs_exist_ok=True) + shutil.copytree("grammalecte-js", "_build/nodejs/"+sLang+"/core/grammalecte", dirs_exist_ok=True) Index: gc_lang/fr/dictionnaire/genfrdic.py ================================================================== --- gc_lang/fr/dictionnaire/genfrdic.py +++ gc_lang/fr/dictionnaire/genfrdic.py @@ -11,14 +11,12 @@ import collections import zipfile import math import argparse import tags +import shutil from enum import Enum - -from distutils import dir_util -from distutils import file_util from string import Template import tags import metagraphe @@ -195,10 +193,15 @@ for sLine in hSrc: yield sLine else: print("# Error: file not found.") + +def createFolder (sp): + "make a folder if it doesn’t exist; don’t change anything if it exists" + if not os.path.exists(sp): + os.mkdir(sp) class Dictionnaire: def __init__ (self, version, name): # Dictionary @@ -525,11 +528,11 @@ hDst.write(oFlex.getGrammarCheckerRepr()) def createFiles (self, spDst, lDictVars, nMode, bSimplified): sDicName = PREFIX_DICT_PATH + self.sVersion spDic = spDst + '/' + sDicName - dir_util.mkpath(spDic) + createFolder(spDic) for dVars in lDictVars: # template vars dVars['version'] = self.sVersion # Dictionaries files (.dic) (.aff) self.writeAffixes(spDic, dVars, nMode, bSimplified) @@ -541,66 +544,66 @@ # LibreOffice extension echo(" * Dictionnaire >> extension pour LibreOffice") dTplVars['version'] = self.sVersion sExtensionName = EXT_PREFIX_OOO + self.sVersion spExt = spBuild + '/' + sExtensionName - dir_util.mkpath(spExt+'/META-INF') - dir_util.mkpath(spExt+'/ui') - dir_util.mkpath(spExt+'/dictionaries') - dir_util.mkpath(spExt+'/pythonpath') - file_util.copy_file('_templates/ooo/manifest.xml', spExt+'/META-INF') - file_util.copy_file('_templates/ooo/DictionarySwitcher.py', spExt) - file_util.copy_file('_templates/ooo/ds_strings.py', spExt+'/pythonpath') - file_util.copy_file('_templates/ooo/addons.xcu', spExt+'/ui') - file_util.copy_file('_templates/ooo/french_flag.png', spExt) - file_util.copy_file('_templates/ooo/french_flag_16.bmp', spExt+'/ui') + createFolder(spExt+'/META-INF') + createFolder(spExt+'/ui') + createFolder(spExt+'/dictionaries') + createFolder(spExt+'/pythonpath') + shutil.copy2('_templates/ooo/manifest.xml', spExt+'/META-INF') + shutil.copy2('_templates/ooo/DictionarySwitcher.py', spExt) + shutil.copy2('_templates/ooo/ds_strings.py', spExt+'/pythonpath') + shutil.copy2('_templates/ooo/addons.xcu', spExt+'/ui') + shutil.copy2('_templates/ooo/french_flag.png', spExt) + shutil.copy2('_templates/ooo/french_flag_16.bmp', spExt+'/ui') copyTemplate('_templates/ooo', spExt, 'description.xml', dTplVars) copyTemplate('_templates/ooo', spExt, 'dictionaries.xcu', dTplVars) - #file_util.copy_file('_templates/ooo/dictionaries.xcu.tpl.xml', spExt) + #shutil.copy2('_templates/ooo/dictionaries.xcu.tpl.xml', spExt) copyTemplate('_templates/ooo', spExt, 'package-description.txt', dTplVars) for dVars in lDictVars: dicPath = spBuild + '/' + PREFIX_DICT_PATH + self.sVersion - file_util.copy_file(dicPath+'/'+dVars['asciiName']+'.dic', spExt+'/dictionaries/'+dVars['asciiName']+'.dic') - file_util.copy_file(dicPath+'/'+dVars['asciiName']+'.aff', spExt+'/dictionaries/'+dVars['asciiName']+'.aff') + shutil.copy2(dicPath+'/'+dVars['asciiName']+'.dic', spExt+'/dictionaries/'+dVars['asciiName']+'.dic') + shutil.copy2(dicPath+'/'+dVars['asciiName']+'.aff', spExt+'/dictionaries/'+dVars['asciiName']+'.aff') copyTemplate('orthographe', spExt+'/dictionaries', 'README_dict_fr.txt', dTplVars) # hyphenation - file_util.copy_file('césures/hyph_fr.dic', spExt+'/dictionaries') - file_util.copy_file('césures/hyph_fr.iso8859-1.dic', spExt+'/dictionaries') - file_util.copy_file('césures/frhyph.tex', spExt+'/dictionaries') - file_util.copy_file('césures/hyph-fr.tex', spExt+'/dictionaries') - file_util.copy_file('césures/README_hyph_fr-3.0.txt', spExt+'/dictionaries') - file_util.copy_file('césures/README_hyph_fr-2.9.txt', spExt+'/dictionaries') + shutil.copy2('césures/hyph_fr.dic', spExt+'/dictionaries') + shutil.copy2('césures/hyph_fr.iso8859-1.dic', spExt+'/dictionaries') + shutil.copy2('césures/frhyph.tex', spExt+'/dictionaries') + shutil.copy2('césures/hyph-fr.tex', spExt+'/dictionaries') + shutil.copy2('césures/README_hyph_fr-3.0.txt', spExt+'/dictionaries') + shutil.copy2('césures/README_hyph_fr-2.9.txt', spExt+'/dictionaries') # thesaurus - file_util.copy_file(spBuild+"/thesaurus-v"+sThesVer+'/thes_fr.dat', spExt+"/dictionaries") - file_util.copy_file(spBuild+"/thesaurus-v"+sThesVer+'/thes_fr.idx', spExt+"/dictionaries") - file_util.copy_file(spBuild+"/thesaurus-v"+sThesVer+'/README_thes_fr.txt', spExt+"/dictionaries") + shutil.copy2(spBuild+"/thesaurus-v"+sThesVer+'/thes_fr.dat', spExt+"/dictionaries") + shutil.copy2(spBuild+"/thesaurus-v"+sThesVer+'/thes_fr.idx', spExt+"/dictionaries") + shutil.copy2(spBuild+"/thesaurus-v"+sThesVer+'/README_thes_fr.txt', spExt+"/dictionaries") # zip createZipFiles(spExt, spBuild, sExtensionName + '.oxt') # copy to Grammalecte Project if spDestGL: echo(" Dictionnaires Hunspell copiés dans Grammalecte pour LibreOffice...") - dir_util.copy_tree(spExt+'/dictionaries', spDestGL) + shutil.copytree(spExt+'/dictionaries', spDestGL, dirs_exist_ok=True) def createMozillaExtensions (self, spBuild, dTplVars, lDictVars, spDestGL=""): # Mozilla extension 1 echo(" * Dictionnaire >> extension pour Mozilla") dTplVars['version'] = self.sVersion sExtensionName = EXT_PREFIX_MOZ + self.sVersion spExt = spBuild + '/' + sExtensionName - dir_util.mkpath(spExt+'/dictionaries') + createFolder(spExt+'/dictionaries') copyTemplate('_templates/moz', spExt, 'manifest.json', dTplVars) spDict = spBuild + '/' + PREFIX_DICT_PATH + self.sVersion - file_util.copy_file(spDict+'/fr-classique.dic', spExt+'/dictionaries/fr-classic.dic') - file_util.copy_file(spDict+'/fr-classique.aff', spExt+'/dictionaries/fr-classic.aff') + shutil.copy2(spDict+'/fr-classique.dic', spExt+'/dictionaries/fr-classic.dic') + shutil.copy2(spDict+'/fr-classique.aff', spExt+'/dictionaries/fr-classic.aff') copyTemplate('orthographe', spExt, 'README_dict_fr.txt', dTplVars) createZipFiles(spExt, spBuild, sExtensionName + '.xpi') # Grammalecte if spDestGL: echo(" Dictionnaires Hunspell copiés dans Grammalecte pour Mozilla") for dVars in lDictVars: - file_util.copy_file(spDict+'/'+dVars['asciiName']+'.dic', spDestGL+'/'+dVars['mozAsciiName']+"/"+dVars['mozAsciiName']+'.dic') - file_util.copy_file(spDict+'/'+dVars['asciiName']+'.aff', spDestGL+'/'+dVars['mozAsciiName']+"/"+dVars['mozAsciiName']+'.aff') + shutil.copy2(spDict+'/'+dVars['asciiName']+'.dic', spDestGL+'/'+dVars['mozAsciiName']+"/"+dVars['mozAsciiName']+'.dic') + shutil.copy2(spDict+'/'+dVars['asciiName']+'.aff', spDestGL+'/'+dVars['mozAsciiName']+"/"+dVars['mozAsciiName']+'.aff') def createFileIfqForDB (self, spBuild): echo(" * Dictionnaire >> indices de fréquence pour la DB...") with open(spBuild+'/dictIdxIfq-'+self.sVersion+'.diff.txt', 'w', encoding='utf-8', newline="\n") as hDiff, \ open(spBuild+'/dictIdxIfq-'+self.sVersion+'.notes.txt', 'w', encoding='utf-8', newline="\n") as hNotes: @@ -610,42 +613,42 @@ hNotes.write("{0.lemma}/{0.flags}\t{0.oldFq} > {0.fq}\n".format(oEntry)) def createLexiconPackages (self, spBuild, version, oStatsLex, spDestGL=""): sLexName = LEX_PREFIX + version spLex = spBuild + '/' + sLexName - dir_util.mkpath(spLex) + createFolder(spLex) # write lexicon self.sortLexiconByFreq() self.writeLexicon(spLex + '/' + sLexName + '.txt', version, oStatsLex) self.writeGrammarCheckerLexicon(spBuild + '/' + sLexName + '.lex', version) copyTemplate('lexique', spLex, 'README_lexique.txt', {'version': version}) # zip createZipFiles(spLex, spBuild, sLexName + '.zip') # copy GC lexicon to Grammalecte if spDestGL: - file_util.copy_file(spBuild + '/' + sLexName + '.lex', spDestGL + '/French.lex') - file_util.copy_file('lexique/French.tagset.txt', spDestGL) + shutil.copy2(spBuild + '/' + sLexName + '.lex', spDestGL + '/French.lex') + shutil.copy2('lexique/French.tagset.txt', spDestGL) def createDictConj (self, spBuild, spDestGL=""): echo(" * Dictionnaire >> fichier de conjugaison...") with open(spBuild+'/dictConj.txt', 'w', encoding='utf-8', newline="\n") as hDst: for oEntry in self.lEntry: if oEntry.po.startswith("v"): hDst.write(oEntry.getConjugation()) if spDestGL: echo(" Fichier de conjugaison copié dans Grammalecte...") - file_util.copy_file(spBuild+'/dictConj.txt', spDestGL) + shutil.copy2(spBuild+'/dictConj.txt', spDestGL) def createDictDecl (self, spBuild, spDestGL=""): echo(" * Dictionnaire >> fichier de déclinaison...") with open(spBuild+'/dictDecl.txt', 'w', encoding='utf-8', newline="\n") as hDst: for oEntry in self.lEntry: if re.match("[SXFWIA]", oEntry.flags) and (oEntry.po.startswith("nom") or oEntry.po.startswith("adj")): hDst.write(oEntry.getDeclination()) if spDestGL: echo(" Fichier de déclinaison copié dans Grammalecte...") - file_util.copy_file(spBuild+'/dictDecl.txt', spDestGL) + shutil.copy2(spBuild+'/dictDecl.txt', spDestGL) class Entree: def __init__ (self, sLine): self.lemma = '' @@ -1411,22 +1414,22 @@ def createThesaurusPackage (spBuild, sVersion, spCopy="", spDataDestGL=""): print(" * Création du thésaurus") spThesaurus = spBuild+"/thesaurus-v"+sVersion - dir_util.mkpath(spThesaurus) + createFolder(spThesaurus) thes_build.build("thesaurus/thes_fr.dat", "thesaurus/synsets_fr.dat", spThesaurus) - file_util.copy_file('thesaurus/README_thes_fr.txt', spThesaurus) + shutil.copy2('thesaurus/README_thes_fr.txt', spThesaurus) if spCopy: # copy in libreoffice extension package print(" Copie du thésaurus dans:", spCopy) - file_util.copy_file(spThesaurus+'/thes_fr.dat', spCopy) - file_util.copy_file(spThesaurus+'/thes_fr.idx', spCopy) - file_util.copy_file(spThesaurus+'/README_thes_fr.txt', spCopy) - if spModulesDestGL: + shutil.copy2(spThesaurus+'/thes_fr.dat', spCopy) + shutil.copy2(spThesaurus+'/thes_fr.idx', spCopy) + shutil.copy2(spThesaurus+'/README_thes_fr.txt', spCopy) + if spDataDestGL: # copy in data source folder of Grammalecte - file_util.copy_file(spThesaurus+'/thes_fr.json', spDataDestGL) + shutil.copy2(spThesaurus+'/thes_fr.json', spDataDestGL) def main (): xParser = argparse.ArgumentParser() xParser.add_argument("-v", "--verdic", help="set dictionary version, i.e. 5.4", type=str, default="X.Y.z") @@ -1446,11 +1449,11 @@ echo("Mode: " + str(xArgs.mode)) echo("Compression: " + str(not(xArgs.uncompress))) ### création du répertoire spBuild = BUILD_PATH + '/' + xArgs.verdic - dir_util.mkpath(spBuild) + createFolder(spBuild) ### Lecture des fichiers et création du dictionnaire oFrenchDict = Dictionnaire(xArgs.verdic, "French dictionary") for sFile in ['orthographe/FRANCAIS.dic']: oFrenchDict.readDictionary(sFile) @@ -1478,11 +1481,11 @@ oFrenchDict.calculateStats(oStatsLex, spfStats) ### Écriture des paquets echo("Création des paquets...") - nThesaurusVersion = 2.4 + sThesaurusVersion = "3.0" spLexiconDestGL = "../../../lexicons" if xArgs.grammalecte else "" spLibreOfficeExtDestGL = "../oxt/Dictionnaires/dictionaries" if xArgs.grammalecte else "" spMozillaExtDestGL = "" if xArgs.grammalecte else "" # no more Hunspell dictionaries in Mozilla extensions for now spDataDestGL = "../data" if xArgs.grammalecte else "" @@ -1490,14 +1493,14 @@ if not xArgs.uncompress: oFrenchDict.defineAbreviatedTags(xArgs.mode, spfStats) oFrenchDict.createFiles(spBuild, [dTOUTESVAR, dCLASSIQUE, dREFORME1990], xArgs.mode, xArgs.simplify) oFrenchDict.createLexiconPackages(spBuild, xArgs.verdic, oStatsLex, spLexiconDestGL) oFrenchDict.createFileIfqForDB(spBuild) - createThesaurusPackage(spBuild, nThesaurusVersion, spLibreOfficeExtDestGL, spDataDestGL) - oFrenchDict.createLibreOfficeExtension(spBuild, dMOZEXT, [dTOUTESVAR, dCLASSIQUE, dREFORME1990], nThesaurusVersion, spLibreOfficeExtDestGL) + createThesaurusPackage(spBuild, sThesaurusVersion, spLibreOfficeExtDestGL, spDataDestGL) + oFrenchDict.createLibreOfficeExtension(spBuild, dMOZEXT, [dTOUTESVAR, dCLASSIQUE, dREFORME1990], sThesaurusVersion, spLibreOfficeExtDestGL) oFrenchDict.createMozillaExtensions(spBuild, dMOZEXT, [dTOUTESVAR, dCLASSIQUE, dREFORME1990], spMozillaExtDestGL) oFrenchDict.createDictConj(spBuild, spDataDestGL) oFrenchDict.createDictDecl(spBuild, spDataDestGL) if __name__ == '__main__': main() Index: helpers.py ================================================================== --- helpers.py +++ helpers.py @@ -74,10 +74,16 @@ if not os.path.exists(sp): os.makedirs(sp, exist_ok=True) else: eraseFolderContent(sp) + +def createFolder (sp): + "make a folder if it doesn’t exist; don’t change anything if it exists" + if not os.path.exists(sp): + os.mkdir(sp) + def copyFolder (spSrc, spDst): "copy folder content from src to dst" try: shutil.copytree(spSrc, spDst) Index: lex_build.py ================================================================== --- lex_build.py +++ lex_build.py @@ -3,22 +3,22 @@ """ Lexicon builder """ import argparse -from distutils import dir_util +import helpers import graphspell.dawg as fsa def build (spfSrc, sLangCode, sLangName, sfDict, bJavaScript=False, sDicName="", sDescription="", sFilter="", cStemmingMethod="S", nCompressMethod=1): "transform a text lexicon as a binary indexable dictionary" oDAWG = fsa.DAWG(spfSrc, cStemmingMethod, sLangCode, sLangName, sDicName, sDescription, sFilter) - dir_util.mkpath("graphspell/_dictionaries") + helpers.createFolder("graphspell/_dictionaries") oDAWG.writeAsJSObject("graphspell/_dictionaries/" + sfDict + ".json") if bJavaScript: - dir_util.mkpath("graphspell-js/_dictionaries") + helpers.createFolder("graphspell-js/_dictionaries") oDAWG.writeAsJSObject("graphspell-js/_dictionaries/" + sfDict + ".json") def main (): "parse args from CLI" Index: make.py ================================================================== --- make.py +++ make.py @@ -15,14 +15,13 @@ import argparse import importlib import unittest import json import platform +import shutil -from distutils import dir_util, file_util - -#import dialog_bundled +#im2port dialog_bundled import compile_rules import helpers import lex_build @@ -206,11 +205,11 @@ ## 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) - file_util.copy_file("3rd/bottle.py", "grammalecte/bottle.py") + shutil.copy2("3rd/bottle.py", "grammalecte/bottle.py") open("grammalecte/WARNING.txt", "w", encoding="utf-8", newline="\n").write(sWarningMessage) ## CREATE GRAMMAR CHECKER PACKAGE spLangPack = "grammalecte/"+sLang helpers.createCleanFolder(spLangPack) @@ -284,23 +283,23 @@ def copyGraphspellCore (bJavaScript=False): "copy Graphspell package in Grammalecte package" print("> Copy Graphspell package in Grammalecte package") helpers.createCleanFolder("grammalecte/graphspell") - dir_util.mkpath("grammalecte/graphspell/_dictionaries") + helpers.createFolder("grammalecte/graphspell/_dictionaries") for sf in os.listdir("graphspell"): if not os.path.isdir("graphspell/"+sf): - file_util.copy_file("graphspell/"+sf, "grammalecte/graphspell") + shutil.copy2("graphspell/"+sf, "grammalecte/graphspell") if bJavaScript: helpers.createCleanFolder("grammalecte-js/graphspell") - dir_util.mkpath("grammalecte-js/graphspell/_dictionaries") + helpers.createFolder("grammalecte-js/graphspell/_dictionaries") dVars = {} for sf in os.listdir("js_extension"): dVars[sf[:-3]] = open("js_extension/"+sf, "r", encoding="utf-8").read() 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") + shutil.copy2("graphspell-js/"+sf, "grammalecte-js/graphspell") helpers.copyAndFileTemplate("graphspell-js/"+sf, "grammalecte-js/graphspell/"+sf, dVars) def copyGraphspellDictionaries (dVars, bJavaScript=False, bCommunityDict=False, bPersonalDict=False): "copy requested Graphspell dictionaries in Grammalecte package" @@ -320,15 +319,15 @@ spfPyDic = f"graphspell/_dictionaries/{sFileName}.json" spfJSDic = f"graphspell-js/_dictionaries/{sFileName}.json" if not os.path.isfile(spfPyDic) or (bJavaScript and not os.path.isfile(spfJSDic)): buildDictionary(dVars, sType, bJavaScript) print(" +", spfPyDic) - file_util.copy_file(spfPyDic, "grammalecte/graphspell/_dictionaries") + shutil.copy2(spfPyDic, "grammalecte/graphspell/_dictionaries") dVars['dic_'+sType+'_filename_py'] = sFileName + '.json' if bJavaScript: print(" +", spfJSDic) - file_util.copy_file(spfJSDic, "grammalecte-js/graphspell/_dictionaries") + shutil.copy2(spfJSDic, "grammalecte-js/graphspell/_dictionaries") dVars['dic_'+sType+'_filename_js'] = sFileName + '.json' dVars['dic_main_filename_py'] = dVars['dic_default_filename_py'] + ".json" dVars['dic_main_filename_js'] = dVars['dic_default_filename_js'] + ".json" @@ -395,11 +394,11 @@ xParser.add_argument("lang", type=str, nargs='+', help="lang project to generate (name of folder in /lang)") xParser.add_argument("-uc", "--use_cache", help="use data cache instead of rebuilding rules", action="store_true") xParser.add_argument("-frb", "--force_rebuild", help="force rebuilding rules", action="store_true") xParser.add_argument("-b", "--build_data", help="launch build_data.py (part 1 and 2)", action="store_true") xParser.add_argument("-bb", "--build_data_before", help="launch build_data.py (only part 1: before dictionary building)", action="store_true") - xParser.add_argument("-ba", "--build_data_after", help="launch build_data.py (only part 2: before dictionary building)", action="store_true") + xParser.add_argument("-ba", "--build_data_after", help="launch build_data.py (only part 2: after dictionary building)", action="store_true") xParser.add_argument("-d", "--dict", help="generate FSA dictionary", action="store_true") xParser.add_argument("-t", "--tests", help="run unit tests", action="store_true") xParser.add_argument("-tt", "--test_texts", help="perform gc tests on texts", action="store_true") xParser.add_argument("-p", "--perf", help="run performance tests", action="store_true") xParser.add_argument("-pm", "--perf_memo", help="run performance tests and store results in perf_memo.txt", action="store_true") @@ -420,14 +419,14 @@ if xArgs.build_data: xArgs.build_data_before = True xArgs.build_data_after = True - dir_util.mkpath("_build") - dir_util.mkpath("grammalecte") + helpers.createFolder("_build") + helpers.createFolder("grammalecte") if xArgs.javascript: - dir_util.mkpath("grammalecte-js") + helpers.createFolder("grammalecte-js") copyGraphspellCore(xArgs.javascript) for sLang in xArgs.lang: if os.path.exists("gc_lang/"+sLang) and os.path.isdir("gc_lang/"+sLang):