Overview
| Comment: | [build][fr] drop the obsolete distutils library and fix the thesaurus builder |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | trunk | fr | build |
| Files: | files | file ages | folders |
| SHA3-256: |
652870dcf1f26dbc9ed9ce20f6d56930 |
| User & Date: | olr on 2025-11-24 16:56:04 |
| Other Links: | manifest | tags |
Context
|
2025-11-24
| ||
| 16:56 | [build][fr] drop the obsolete distutils library and fix the thesaurus builder Leaf check-in: 652870dcf1 user: olr tags: trunk, fr, build | |
| 15:13 | [fr] Thésaurus: corrections diverses check-in: e5e387416d user: olr tags: trunk, fr | |
Changes
Modified gc_lang/fr/build.py from [fab4b52b52] to [b75fae61f7].
1 2 3 4 5 6 7 8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | - - - + + | # Builder for French language import os import platform import zipfile import shutil import json import traceback |
| ︙ | |||
85 86 87 88 89 90 91 | 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | - + - + - - + + |
helpers.addFolderToZipAndFileFile(hZip, f"gc_lang/{sLang}/webext/panel", "panel", dVars, True)
hZip.close()
# Note about copying Thunderbird extension directly into the profile:
# In Options > Configuration editor (about:config), deactivate option <xpinstall.whitelist.required>
# If <manifest.json> 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):
|
Modified gc_lang/fr/dictionnaire/genfrdic.py from [23c6a753b0] to [7c1521954d].
| ︙ | |||
9 10 11 12 13 14 15 16 | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | + - - - | import sys import re import collections import zipfile import math import argparse import tags import shutil from enum import Enum |
| ︙ | |||
193 194 195 196 197 198 199 200 201 202 203 204 205 206 | 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | + + + + + |
if os.path.isfile(spf):
with open(spf, "r", encoding="utf-8") as hSrc:
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
self.sName = name
self.lEntry = []
|
| ︙ | |||
523 524 525 526 527 528 529 | 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 | - + - - - - - - - - - - + + + + + + + + + + - + - - + + - - - - - - + + + + + + - - - + + + - + - + - - + + - - + + - + - - + + - + - + |
hDst.write(Flexion.simpleHeader())
for oFlex in self.lFlexions:
hDst.write(oFlex.getGrammarCheckerRepr())
def createFiles (self, spDst, lDictVars, nMode, bSimplified):
sDicName = PREFIX_DICT_PATH + self.sVersion
spDic = spDst + '/' + sDicName
|
| ︙ | |||
1409 1410 1411 1412 1413 1414 1415 | 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 | - + - + - - - - + + + + - + |
for e in self.dFlexions.items():
hDst.write("{} - {}\n".format(e[0], e[1]))
def createThesaurusPackage (spBuild, sVersion, spCopy="", spDataDestGL=""):
print(" * Création du thésaurus")
spThesaurus = spBuild+"/thesaurus-v"+sVersion
|
| ︙ | |||
1444 1445 1446 1447 1448 1449 1450 | 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 | - + |
echo("Version: " + xArgs.verdic)
echo("Simplify: " + str(xArgs.simplify))
echo("Mode: " + str(xArgs.mode))
echo("Compression: " + str(not(xArgs.uncompress)))
### création du répertoire
spBuild = BUILD_PATH + '/' + xArgs.verdic
|
| ︙ | |||
1476 1477 1478 1479 1480 1481 1482 | 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 | - + - - + + |
oStatsLex.addLexFromFile('lexique/corpus_data/stats_litterature.txt', 'L', 'Littérature')
oStatsLex.write(spBuild+'/test_lex.txt')
oFrenchDict.calculateStats(oStatsLex, spfStats)
### Écriture des paquets
echo("Création des paquets...")
|
Modified helpers.py from [3b783d8a38] to [864faa54a3].
| ︙ | |||
72 73 74 75 76 77 78 79 80 81 82 83 84 85 | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | + + + + + + |
def createCleanFolder (sp):
"make an empty folder or erase its content if not empty"
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)
except OSError as e:
if e.errno == errno.ENOTDIR:
|
| ︙ |
Modified lex_build.py from [c6d9c2afcf] to [f032803b08].
1 2 3 4 5 6 7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | - + - + - + | #!python3 """ Lexicon builder """ import argparse |
| ︙ |
Modified make.py from [03f1f86c56] to [a2a625b112].
| ︙ | |||
13 14 15 16 17 18 19 | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | - + - - + | import configparser import datetime import argparse import importlib import unittest import json import platform |
| ︙ | |||
204 205 206 207 208 209 210 | 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | - + |
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)
|
| ︙ | |||
282 283 284 285 286 287 288 | 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 | - + - + - + - + |
return dVars['version']
def copyGraphspellCore (bJavaScript=False):
"copy Graphspell package in Grammalecte package"
print("> Copy Graphspell package in Grammalecte package")
helpers.createCleanFolder("grammalecte/graphspell")
|
| ︙ | |||
318 319 320 321 322 323 324 | 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 | - + - + |
lDict.append(("personal", dVars['dic_personal_filename']))
for sType, sFileName in lDict:
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)
|
| ︙ | |||
393 394 395 396 397 398 399 | 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | - + |
return
xParser = argparse.ArgumentParser()
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")
|
| ︙ | |||
418 419 420 421 422 423 424 | 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | - - + + - + |
oNow = datetime.datetime.now()
print("============== MAKE GRAMMALECTE at {0.hour:>2} h {0.minute:>2} min {0.second:>2} s ==============".format(oNow))
if xArgs.build_data:
xArgs.build_data_before = True
xArgs.build_data_after = True
|
| ︙ |