Index: gc_lang/fr/build.py
==================================================================
--- gc_lang/fr/build.py
+++ gc_lang/fr/build.py
@@ -6,14 +6,15 @@
from distutils import dir_util, file_util
import helpers
-def build (sLang, dVars, spLangPack):
+def build (sLang, dVars):
"complementary build launched from make.py"
createWebExtension(sLang, dVars)
- createThunderbirdExtension(sLang, dVars, spLangPack)
+ createThunderbirdExtension(sLang, dVars)
+ createMailExtension(sLang, dVars)
createNodeJSPackage(sLang)
def createWebExtension (sLang, dVars):
"create Web-extension"
@@ -38,27 +39,40 @@
sHTML += f'
\n'
sHTML += '\n'
return sHTML
-def createThunderbirdExtension (sLang, dVars, spLangPack):
- "create extension for Thunderbird"
+def createMailExtension (sLang, dVars):
+ "create extension for Thunderbird (as MailExtension)"
+ print("Building extension for Thunderbird (MailExtension)")
+ spfZip = "_build/" + dVars['tb_identifier'] + "-v" + dVars['version'] + '.mailext.xpi'
+ hZip = zipfile.ZipFile(spfZip, mode='w', compression=zipfile.ZIP_DEFLATED)
+ _copyGrammalecteJSPackageInZipFile(hZip, sLang)
+ for spf in ["LICENSE.txt", "LICENSE.fr.txt"]:
+ hZip.write(spf)
+ dVars = _createOptionsForThunderbird(dVars)
+ helpers.addFolderToZipAndFileFile(hZip, "gc_lang/"+sLang+"/mailext", "", dVars, True)
+ hZip.close()
+ spExtension = dVars['win_tb_debug_extension_path'] if platform.system() == "Windows" else dVars['linux_tb_debug_extension_path']
+ file_util.copy_file(spfZip, spExtension + "/" + dVars['tb_identifier']+ ".xpi") # Filename for TB is just
+ spExtension = dVars['win_tb_beta_extension_path'] if platform.system() == "Windows" else dVars['linux_tb_beta_extension_path']
+ file_util.copy_file(spfZip, spExtension + "/" + dVars['tb_identifier']+ ".xpi") # Filename for TB is just
+
+
+def createThunderbirdExtension (sLang, dVars):
+ "create extension for Thunderbird (as XUL addon)"
print("Building extension for Thunderbird")
- sExtensionName = dVars['tb_identifier'] + "-v" + dVars['version'] + '.xpi'
- spfZip = "_build/" + sExtensionName
+ spfZip = "_build/" + dVars['tb_identifier'] + "-v" + dVars['version'] + '.xpi'
hZip = zipfile.ZipFile(spfZip, mode='w', compression=zipfile.ZIP_DEFLATED)
- _copyGrammalecteJSPackageInZipFile(hZip, spLangPack)
+ _copyGrammalecteJSPackageInZipFile(hZip, sLang)
for spf in ["LICENSE.txt", "LICENSE.fr.txt"]:
hZip.write(spf)
dVars = _createOptionsForThunderbird(dVars)
helpers.addFolderToZipAndFileFile(hZip, "gc_lang/"+sLang+"/tb", "", dVars, True)
hZip.close()
- spDebugProfile = dVars['win_tb_debug_extension_path'] if platform.system() == "Windows" else dVars['linux_tb_debug_extension_path']
- helpers.unzip(spfZip, spDebugProfile)
- spfBetaExtension = dVars['win_tb_beta_extension_filepath'] if platform.system() == "Windows" else dVars['linux_tb_beta_extension_filepath']
- #helpers.unzip(spfZip, spBetaProfile)
- file_util.copy_file(spfZip, spfBetaExtension)
+ #spDebugProfile = dVars['win_tb_debug_extension_path'] if platform.system() == "Windows" else dVars['linux_tb_debug_extension_path']
+ #helpers.unzip(spfZip, spDebugProfile)
def _createOptionsForThunderbird (dVars):
dVars['sXULTabs'] = ""
dVars['sXULTabPanels'] = ""
@@ -74,24 +88,24 @@
for sLang in dVars['dOptLabel'].keys():
dVars['gc_options_labels_'+sLang] = "\n".join( [ "' for sOpt in dVars['dOptLabel'][sLang] ] )
return dVars
-def _copyGrammalecteJSPackageInZipFile (hZip, spLangPack, sAddPath=""):
+def _copyGrammalecteJSPackageInZipFile (hZip, sLang, sAddPath=""):
for sf in os.listdir("grammalecte-js"):
if not os.path.isdir("grammalecte-js/"+sf):
- hZip.write("grammalecte-js/"+sf, sAddPath+"grammalecte-js/"+sf)
+ hZip.write("grammalecte-js/"+sf, sAddPath+"grammalecte/"+sf)
for sf in os.listdir("grammalecte-js/graphspell"):
if not os.path.isdir("grammalecte-js/graphspell/"+sf):
- hZip.write("grammalecte-js/graphspell/"+sf, sAddPath+"grammalecte-js/graphspell/"+sf)
+ hZip.write("grammalecte-js/graphspell/"+sf, sAddPath+"grammalecte/graphspell/"+sf)
for sf in os.listdir("grammalecte-js/graphspell/_dictionaries"):
if not os.path.isdir("grammalecte-js/graphspell/_dictionaries/"+sf):
- hZip.write("grammalecte-js/graphspell/_dictionaries/"+sf, sAddPath+"grammalecte-js/graphspell/_dictionaries/"+sf)
- for sf in os.listdir(spLangPack):
- if not os.path.isdir(spLangPack+"/"+sf):
- hZip.write(spLangPack+"/"+sf, sAddPath+spLangPack+"/"+sf)
+ hZip.write("grammalecte-js/graphspell/_dictionaries/"+sf, sAddPath+"grammalecte/graphspell/_dictionaries/"+sf)
+ for sf in os.listdir("grammalecte-js/"+sLang):
+ if not os.path.isdir("grammalecte-js/"+sLang+"/"+sf):
+ hZip.write("grammalecte-js/"+sLang+"/"+sf, sAddPath+"grammalecte/"+sLang+"/"+sf)
def createNodeJSPackage (sLang):
helpers.createCleanFolder("_build/nodejs/"+sLang)
dir_util.copy_tree("gc_lang/"+sLang+"/nodejs/", "_build/nodejs/"+sLang)
dir_util.copy_tree("grammalecte-js", "_build/nodejs/"+sLang+"/core/grammalecte")
Index: gc_lang/fr/config.ini
==================================================================
--- gc_lang/fr/config.ini
+++ gc_lang/fr/config.ini
@@ -8,11 +8,11 @@
# always use 3 numbers for version: x.y.z
version = 1.3.2
author = Olivier R.
provider = Grammalecte.net
link = https://grammalecte.net
-description = Correcteur grammatical pour le français.
+description = Correcteur grammatical, orthographique et typographique pour le français.
extras = README_fr.txt
logo = logo.png
# main dictionary
lexicon_src = lexicons/French.lex
@@ -54,18 +54,17 @@
# Thunderbird
tb_identifier = French-GC-TB@grammalecte.net
tb_name = Grammalecte [fr]
win_tb_path = C:\Program Files (x86)\Mozilla Thunderbird\thunderbird.exe
-#win_tb_beta_path = C:\Program Files (x86)\Mozilla Thunderbird (Beta)\thunderbird.exe
-win_tb_beta_path = C:\Program Files (x86)\Mozilla Thunderbird (Beta)\thunderbird.exe
+win_tb_beta_path = C:\Program Files\Thunderbird Daily\thunderbird.exe
linux_tb_path = /usr/bin/thunderbird
linux_tb_beta_path = /usr/bin/thunderbird
-win_tb_debug_extension_path = D:\_temp\tb-debug.profile\extensions\French-GC-TB@grammalecte.net
-linux_tb_debug_extension_path = ~/tb-debug.profile/extensions/French-GC-TB@grammalecte.net
-win_tb_beta_extension_filepath = D:\_temp\tb-beta.profile\extensions\French-GC-TB@grammalecte.net.xpi
-linux_tb_beta_extension_filepath = ~/tb-beta.profile/extensions/French-GC-TB@grammalecte.net.xpi
+win_tb_debug_extension_path = D:\_temp\tb-debug.profile\extensions
+linux_tb_debug_extension_path = ~/tb-debug.profile/extensions
+win_tb_beta_extension_path = D:\_temp\tb-beta.profile\extensions
+linux_tb_beta_extension_path = ~/tb-beta.profile/extensions
# Set Thunderbird folder in your PATH variable
# Create a local profile:
# thunderbird -CreateProfile "debug _build\tb-debug.profile"
# Or you can use the GUI with:
# thunderbird -P
Index: helpers.py
==================================================================
--- helpers.py
+++ helpers.py
@@ -34,11 +34,11 @@
if os.path.isdir(spInstall):
eraseFolder(spInstall)
with zipfile.ZipFile(spfZip) as hZip:
hZip.extractall(spDest)
else:
- print("# folder not found")
+ print("# folder <" + spDest + "> not found")
else:
print("path destination is empty")
def eraseFolder (sp):
@@ -94,9 +94,9 @@
spfDst = (spDst + "/" + sf).strip("/ ")
if os.path.isdir(spfSrc):
if bRecursive:
addFolderToZipAndFileFile(hZip, spfSrc, spfDst, dVars, bRecursive)
else:
- if spfSrc.endswith((".py", ".js", ".css", ".xcu", ".xul", ".rdf", ".dtd", ".properties")):
+ if spfSrc.endswith((".py", ".js", ".json", ".css", ".xcu", ".xul", ".rdf", ".dtd", ".properties")):
hZip.writestr(spfDst, fileFile(spfSrc, dVars))
else:
hZip.write(spfSrc, spfDst)
Index: make.py
==================================================================
--- make.py
+++ make.py
@@ -285,11 +285,11 @@
try:
buildjs = importlib.import_module("gc_lang."+sLang+".build")
except ImportError:
print("# No complementary builder in folder gc_lang/"+sLang)
else:
- buildjs.build(sLang, dVars, spLangPack)
+ buildjs.build(sLang, dVars)
return dVars['version']
def copyGraphspellCore (bJavaScript=False):