Index: gc_lang/fr/setup.py ================================================================== --- gc_lang/fr/setup.py +++ gc_lang/fr/setup.py @@ -60,11 +60,11 @@ # What does your project relate to? keywords='French grammar checker correcteur grammatical français', # Scripts - scripts=['grammalecte-cli.py', 'grammalecte-server.py', 'grammalecte-server-options.fr.ini'], + scripts=['grammalecte-cli.py', 'grammalecte-server.py'], # You can just specify the packages manually here if your project is # simple. Or you can use find_packages(). # packages=find_packages(exclude=['contrib', 'docs', 'tests']), packages=['grammalecte', 'grammalecte.graphspell', 'grammalecte.fr'], Index: grammalecte-server.py ================================================================== --- grammalecte-server.py +++ grammalecte-server.py @@ -71,17 +71,10 @@

Remise à zéro de ses options

-

Purge des utilisateurs

-
-

heures.

-

-

-
- """ SADLIFEOFAMACHINE = """ @@ -92,26 +85,10 @@ """ TESTPAGE = False - -def getConfigOptions (sLang): - xConfig = configparser.SafeConfigParser() - try: - xConfig.read("grammalecte-server-options." + sLang + ".ini") - except: - echo("Options file [grammalecte-server-options." + sLang + ".ini] not found or not readable") - exit() - try: - dGCOpt = { k: bool(int(v)) for k, v in xConfig._sections['gc_options'].items() } - except: - echo("Error in options file [grammalecte-server-options." + sLang + ".ini]. Dropped.") - traceback.print_exc() - exit() - return dGCOpt - def genUserId (): i = 0 while True: yield str(i) @@ -223,13 +200,10 @@ oLexicographer = oGrammarChecker.getLexicographer() oTextFormatter = oGrammarChecker.getTextFormatter() gce = oGrammarChecker.getGCEngine() echo("Grammalecte v{}".format(gce.version)) -dGCOptions = getConfigOptions("fr") -if dGCOptions: - gce.setOptions(dGCOptions) dServerGCOptions = gce.getOptions() echo("Grammar options:\n" + " | ".join([ k + ": " + str(v) for k, v in sorted(dServerGCOptions.items()) ])) dUser = {} userGenerator = genUserId() @@ -252,11 +226,9 @@ #xParser.add_argument("-on", "--opt_on", nargs="+", help="activate options") #xParser.add_argument("-off", "--opt_off", nargs="+", help="deactivate options") #xParser.add_argument("-roff", "--rule_off", nargs="+", help="deactivate rules") xArgs = xParser.parse_args() - print(xArgs) - - sHost = "localhost" if not xArgs.host else xArgs.host - nPort = 8080 if not xArgs.host else xArgs.port + sHost = xArgs.host or "localhost" + nPort = xArgs.port or 8080 main(sHost, nPort, xArgs.test_page) Index: make.py ================================================================== --- make.py +++ make.py @@ -138,29 +138,17 @@ #subprocess.run(cmd) os.system(cmd) else: print("# Error: path and filename of unopkg not set in config.ini") - -def createServerOptions (sLang, dOptData): - with open("grammalecte-server-options."+sLang+".ini", "w", encoding="utf-8", newline="\n") as hDst: - hDst.write("# Server options. Lang: " + sLang + "\n\n[gc_options]\n") - for sSection, lOpt in dOptData["lStructOpt"]: - hDst.write("\n########## " + dOptData["dOptLabel"][sLang].get(sSection, sSection + "[no label found]")[0] + " ##########\n") - for lLineOpt in lOpt: - for sOpt in lLineOpt: - hDst.write("# " + dOptData["dOptLabel"][sLang].get(sOpt, "[no label found]")[0] + "\n") - hDst.write(sOpt + " = " + ("1" if dOptData["dOptServer"].get(sOpt, None) else "0") + "\n") - hDst.write("html = 1\n") - def createPackageZip (sLang, dVars, spLangPack): "create server zip" spfZip = "_build/" + dVars['name'] + "-"+ dVars['lang'] +"-v" + dVars['version'] + '.zip' hZip = zipfile.ZipFile(spfZip, mode='w', compression=zipfile.ZIP_DEFLATED) copyGrammalectePyPackageInZipFile(hZip, spLangPack) - for spf in ["grammalecte-cli.py", "grammalecte-server.py", "grammalecte-server-options."+sLang+".ini", \ + for spf in ["grammalecte-cli.py", "grammalecte-server.py", \ "README.txt", "LICENSE.txt", "LICENSE.fr.txt"]: hZip.write(spf) hZip.writestr("setup.py", helpers.fileFile("gc_lang/fr/setup.py", dVars)) @@ -231,11 +219,10 @@ hDstPy.write("# TESTS FOR LANG [" + sLang + "]\n\n") hDstPy.write(dVars['gctests']) createOXT(spLang, dVars, xConfig._sections['oxt'], spLangPack, bInstallOXT) - createServerOptions(sLang, dVars) createPackageZip(sLang, dVars, spLangPack) #### JAVASCRIPT if bJavaScript: print("JAVASCRIPT:")