Grammalecte  Check-in [834a8e771b]

Overview
Comment:[build] build graphspell dictionary if not found
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | build
Files: files | file ages | folders
SHA3-256: 834a8e771b7d46d04a2af352d591aeabfd393704930e4a56bcde3e95a2f29157
User & Date: olr on 2017-12-26 15:02:02
Other Links: manifest | tags
Context
2017-12-26
17:53
[build] remove useless echo lines check-in: a1f7ca28ad user: olr tags: trunk, build
15:02
[build] build graphspell dictionary if not found check-in: 834a8e771b user: olr tags: trunk, build
14:43
[graphspell] add forgotten file check-in: f3d1b23584 user: olr tags: trunk, graphspell
Changes

Modified make.py from [bf74b39e46] to [219363c68b].

16
17
18
19
20
21
22

23
24
25
26
27
28
29
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30







+







import platform

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"


def getConfig (sLang):
    xConfig = configparser.SafeConfigParser()
299
300
301
302
303
304
305
306
307
308






309
310





311
312
313
314
315
316
317
300
301
302
303
304
305
306



307
308
309
310
311
312
313

314
315
316
317
318
319
320
321
322
323
324
325







-
-
-
+
+
+
+
+
+

-
+
+
+
+
+







            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")
                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()
    xParser.add_argument("lang", type=str, nargs='+', help="lang project to generate (name of folder in /lang)")
    xParser.add_argument("-b", "--build_data", help="launch build_data.py (part 1 and 2)", action="store_true")
351
352
353
354
355
356
357
358
359

360
361
362
363
364
365

366
367
368
369
370
371
372
359
360
361
362
363
364
365


366
367
368
369
370


371
372
373
374
375
376
377
378







-
-
+




-
-
+







                try:
                    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_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
            if xArgs.tests or xArgs.perf or xArgs.perf_memo:
                print("> Running tests")