347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
|
347
348
349
350
351
352
353
354
355
356
357
358
359
360
|
-
-
-
-
-
|
try:
lRules = open(spLang + "/rules.grx", 'r', encoding="utf-8").readlines()
except:
print("Rules file in project [" + sLang + "] not found")
return
dVars.update(compile_rules.make(lRules, dVars['lang'], bJavaScript))
# generating test files
with open("tests/"+sLang+"/gc_test.txt", "w", encoding="utf-8", newline="\n") as hDstPy:
hDstPy.write("# TESTS FOR LANG [" + sLang + "]\n\n")
hDstPy.write(dVars['gctests'])
## READ GRAMMAR CHECKER PLUGINS
print("PYTHON:")
print("+ Plugins: ", end="")
sCodePlugins = ""
for sf in os.listdir(spLang+"/modules"):
if re.match(r"gce_\w+[.]py$", sf):
sCodePlugins += "\n\n" + open(spLang+'/modules/'+sf, "r", encoding="utf-8").read()
|
376
377
378
379
380
381
382
383
384
385
386
387
388
389
|
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
|
+
+
+
+
+
|
print("+ Modules: ", end="")
for sf in os.listdir(spLang+"/modules"):
if not sf.endswith(".tpl.py") and not sf.startswith("gce_"):
file_util.copy_file(spLang+"/modules/"+sf, spLangPack)
print(sf, end=", ")
print()
# TEST FILES
with open("grammalecte/"+sLang+"/gc_test.txt", "w", encoding="utf-8", newline="\n") as hDstPy:
hDstPy.write("# TESTS FOR LANG [" + sLang + "]\n\n")
hDstPy.write(dVars['gctests'])
createOXT(spLang, dVars, xConfig._sections['oxt'], spLangPack, bInstallOXT)
createServerOptions(sLang, dVars)
createServerZip(sLang, dVars, spLangPack)
#### JAVASCRIPT
if bJavaScript:
|
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
|
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
|
-
+
|
# make
sVersion = create(sLang, xConfig, xArgs.install, xArgs.javascript, )
# tests
if xArgs.tests or xArgs.perf:
print("> Running tests")
try:
tests = importlib.import_module("tests."+sLang+"_test")
tests = importlib.import_module("grammalecte."+sLang+".tests")
print(tests.__file__)
except ImportError:
print("# Error. Couldn't import file {}_test.py in folder tests".format(sLang))
else:
if xArgs.tests:
xTestSuite = unittest.TestLoader().loadTestsFromModule(tests)
unittest.TextTestRunner().run(xTestSuite)
|