Overview
Comment: | [build] new option: force rebuild + code clarification (Python f-strings) |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | build |
Files: | files | file ages | folders |
SHA3-256: |
a3f82d3151d0e2071053c7aafd6abb5f |
User & Date: | olr on 2020-04-22 06:20:17 |
Other Links: | manifest | tags |
Context
2020-04-22
| ||
10:58 | [build] fix URL id check-in: 959afab163 user: olr tags: trunk, build | |
06:20 | [build] new option: force rebuild + code clarification (Python f-strings) check-in: a3f82d3151 user: olr tags: trunk, build | |
04:33 | [build][core] stricter building process, store URLs in a separate dictionary [fr] ajustements (rebuild necessary to avoid bug) check-in: b543565245 user: olr tags: trunk, fr, core, build | |
Changes
Modified compile_rules.py from [0bae5e7ec9] to [f64fcce154].
︙ | |||
135 136 137 138 139 140 141 | 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | - + | return 0 def createRule (s, nIdLine, sLang, bParagraph, dOptPriority): "returns rule as list [option name, regex, bCaseInsensitive, identifier, list of actions]" global dJSREGEXES |
︙ | |||
160 161 162 163 164 165 166 | 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 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 308 309 310 311 312 313 314 315 316 317 318 | - + - + - + - + - + - + - + - + - + - + - + - + - + - + | if m: cWordLimitLeft = m.group('borders_and_case')[0] cCaseMode = m.group('borders_and_case')[1] cWordLimitRight = m.group('borders_and_case')[2] sOption = m.group('option')[1:] if m.group('option') else False sRuleId = m.group('ruleid')[1:-1] if sRuleId in aRULESET: |
︙ | |||
333 334 335 336 337 338 339 | 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 | - + - + - + - + | checkIfThereIsCode(sAction, sIdAction) if cAction == ">": ## no action, break loop if condition is False return [sCondition, cAction, ""] if not sAction: |
︙ | |||
464 465 466 467 468 469 470 | 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 | - + - + - + + - + + | def printBookmark (nLevel, sComment, nLine): "print bookmark within the rules file" print(" {:>6}: {}".format(nLine, " " * nLevel + sComment)) |
︙ | |||
519 520 521 522 523 524 525 | 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 | - + | pass elif sLine.startswith("DEF:"): # definition m = re.match("DEF: +([a-zA-Z_][a-zA-Z_0-9]*) +(.+)$", sLine.strip()) if m: dDEFINITIONS["{"+m.group(1)+"}"] = m.group(2) else: |
︙ | |||
624 625 626 627 628 629 630 | 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 | - + - - + + - + | elif sFuncName.startswith("_s_"): # suggestion sParams = "sSentence, m" elif sFuncName.startswith("_p_"): # preprocessor sParams = "sSentence, m" elif sFuncName.startswith("_d_"): # disambiguator sParams = "sSentence, m, dTokenPos" else: |
︙ |
Modified compile_rules_graph.py from [86b9b97d23] to [3a1bfb17f3].
︙ | |||
97 98 99 100 101 102 103 | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | - | self.dDef = dDef self.dDecl = dDecl self.dOptPriority = dOptPriority self.dAntiPatterns = {} self.dActions = {} self.dFuncName = {} self.dFunctions = {} |
︙ | |||
320 321 322 323 324 325 326 | 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | - + | if cAction == "-": ## error iMsg = sAction.find(" # ") if iMsg == -1: sMsg = "# Error. Error message not found." sURL = "" |
︙ | |||
474 475 476 477 478 479 480 | 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 | - + - + - + - + - + | iActionBlock = 0 aRuleName = set() for iLine, sLine in lRule: sLine = sLine.rstrip() if "\t" in sLine: # tabulation not allowed |
︙ | |||
531 532 533 534 535 536 537 | 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 | - + - + - + | if re.search(r"[-=~/!>](?:-?\d\.?(?::\.?-?\d+|)|):?>>", sLine): bActionBlock = False elif re.match("[ ]*$", sLine): # empty line to end merging if not lTokenLine: continue if bActionBlock or not lActions: |
︙ |
Modified make.py from [1c6f30e738] to [2561b9d2fe].
︙ | |||
30 31 32 33 34 35 36 | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | - + - + - + - + - - - + - + - - + + - - - + + + + - + | def getConfig (sLang): "load config.ini in <sLang> at gc_lang/<sLang>, returns xConfigParser object" xConfig = configparser.ConfigParser() xConfig.optionxform = str try: |
︙ | |||
114 115 116 117 118 119 120 | 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | - + | dVars["xcs_options"] = "\n".join([ '<prop oor:name="'+sOpt+'" oor:type="xs:string"><value></value></prop>' for sOpt in dVars["dOptPython"] ]) dVars["xcu_label_values"] = "\n".join([ '<value xml:lang="'+sLang+'">' + dVars["dOptLabel"][sLang]["__optiontitle__"] + '</value>' for sLang in dVars["dOptLabel"] ]) hZip.writestr("dialog/options_page.xdl", helpers.fileFile("gc_core/py/oxt/options_page.xdl", dVars)) hZip.writestr("dialog/OptionsDialog.xcs", helpers.fileFile("gc_core/py/oxt/OptionsDialog.xcs", dVars)) hZip.writestr("dialog/OptionsDialog.xcu", helpers.fileFile("gc_core/py/oxt/OptionsDialog.xcu", dVars)) hZip.writestr("dialog/" + dVars['lang'] + "_en.default", "") for sLangLbl, dOptLbl in dVars['dOptLabel'].items(): |
︙ | |||
144 145 146 147 148 149 150 | 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | - - - - - - - - - - - - - - + | if dVars.get('unopkg', False): cmd = '"'+os.path.abspath(dVars.get('unopkg')+'" add -f '+spfZip) print(cmd) os.system(cmd) else: print("# Error: path and filename of unopkg not set in config.ini") |
︙ | |||
324 325 326 327 328 329 330 | 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | - - + + | dVars["dic_personal_filename_js"] = "" lDict = [ ("main", s) for s in dVars['dic_filenames'].split(",") ] if bCommunityDict: lDict.append(("community", dVars['dic_community_filename'])) if bPersonalDict: lDict.append(("personal", dVars['dic_personal_filename'])) for sType, sFileName in lDict: |
︙ | |||
372 373 374 375 376 377 378 379 380 381 382 383 384 385 | 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 | + | print("Python: " + sys.version) if sys.version < "3.7": print("Python 3.7+ required") 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") xParser.add_argument("-ba", "--build_data_after", help="launch build_data.py (only part 2: before 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("-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") |
︙ | |||
434 435 436 437 438 439 440 | 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 | + + + + + - + - + | if databuild and xArgs.build_data_after: databuild.after('gc_lang/'+sLang, dVars, xArgs.javascript) # copy dictionaries from Graphspell copyGraphspellDictionaries(dVars, xArgs.javascript, xArgs.add_community_dictionary, xArgs.add_personal_dictionary) # make bUseCache = None # we may rebuild if it’s necessary if xArgs.use_cache: bUseCache = True # we use the cache if it exists if xArgs.force_rebuild: bUseCache = False # we rebuild |
︙ |