Overview
| Comment: | [build] move generated web-extension from deep folder to _build |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk | build |
| Files: | files | file ages | folders |
| SHA3-256: |
22d07b42b27b3b1b55e86a28f9f18d10 |
| User & Date: | olr on 2020-03-20 09:04:31 |
| Other Links: | manifest | tags |
Context
|
2020-03-20
| ||
| 15:12 | [fr] ajustements check-in: 27e118162b user: olr tags: trunk, fr | |
| 09:04 | [build] move generated web-extension from deep folder to _build check-in: 22d07b42b2 user: olr tags: trunk, build | |
| 08:03 | [build] change build option for Firefox Nightly check-in: f1955d65d4 user: olr tags: trunk, build | |
Changes
Modified gc_lang/fr/build.py from [aa2383a06d] to [55ae0943c1].
| ︙ | ︙ | |||
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
dir_util.copy_tree("gc_lang/"+sLang+"/webext/", "_build/webext/"+sLang)
dir_util.copy_tree("grammalecte-js", "_build/webext/"+sLang+"/grammalecte")
dVars['webextOptionsHTML'] = _createOptionsForWebExtension(dVars)
helpers.copyAndFileTemplate("_build/webext/"+sLang+"/manifest.json", "_build/webext/"+sLang+"/manifest.json", dVars)
helpers.copyAndFileTemplate("_build/webext/"+sLang+"/panel/main.html", "_build/webext/"+sLang+"/panel/main.html", dVars)
with helpers.CD("_build/webext/"+sLang):
os.system("web-ext build")
def _createOptionsForWebExtension (dVars):
sHTML = ""
sLang = dVars['sDefaultUILang']
for sSection, lOpt in dVars['lStructOpt']:
sHTML += f'\n<div id="subsection_{sSection}" class="opt_subsection">\n <h2 data-l10n-id="option_{sSection}">{dVars["dOptLabel"][sLang][sSection][0]}</h2>\n'
| > > | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
dir_util.copy_tree("gc_lang/"+sLang+"/webext/", "_build/webext/"+sLang)
dir_util.copy_tree("grammalecte-js", "_build/webext/"+sLang+"/grammalecte")
dVars['webextOptionsHTML'] = _createOptionsForWebExtension(dVars)
helpers.copyAndFileTemplate("_build/webext/"+sLang+"/manifest.json", "_build/webext/"+sLang+"/manifest.json", dVars)
helpers.copyAndFileTemplate("_build/webext/"+sLang+"/panel/main.html", "_build/webext/"+sLang+"/panel/main.html", dVars)
with helpers.CD("_build/webext/"+sLang):
os.system("web-ext build")
# Copy Firefox zip extension to _build
helpers.moveFolderContent("_build/webext/"+sLang+"/web-ext-artifacts", "_build", "fx-"+sLang+"-", True)
def _createOptionsForWebExtension (dVars):
sHTML = ""
sLang = dVars['sDefaultUILang']
for sSection, lOpt in dVars['lStructOpt']:
sHTML += f'\n<div id="subsection_{sSection}" class="opt_subsection">\n <h2 data-l10n-id="option_{sSection}">{dVars["dOptLabel"][sLang][sSection][0]}</h2>\n'
|
| ︙ | ︙ |
Modified helpers.py from [226a504fe3] to [871d0d4238].
| ︙ | ︙ | |||
68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
shutil.copytree(spSrc, spDst)
except OSError as e:
if e.errno == errno.ENOTDIR:
shutil.copy(spSrc, spDst)
else:
raise
def fileFile (spf, dVars):
"return file <spf> as a text filed with variables from <dVars>"
return Template(open(spf, "r", encoding="utf-8").read()).safe_substitute(dVars)
def copyAndFileTemplate (spfSrc, spfDst, dVars):
| > > > > > > > > > > > > > > | 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
shutil.copytree(spSrc, spDst)
except OSError as e:
if e.errno == errno.ENOTDIR:
shutil.copy(spSrc, spDst)
else:
raise
def moveFolderContent (spSrc, spDst, sPrefix="", bLog=False):
"move folder content from <spSrc> to <spDst>: if files already exist in <spDst>, they are replaced. (not recursive)"
try:
for sf in os.listdir(spSrc):
spfSrc = os.path.join(spSrc, sf)
if os.path.isfile(spfSrc):
spfDst = os.path.join(spDst, sPrefix + sf)
shutil.move(spfSrc, spfDst)
if bLog:
print("file <" + spfSrc + "> moved to <"+spfDst+">")
except:
raise
def fileFile (spf, dVars):
"return file <spf> as a text filed with variables from <dVars>"
return Template(open(spf, "r", encoding="utf-8").read()).safe_substitute(dVars)
def copyAndFileTemplate (spfSrc, spfDst, dVars):
|
| ︙ | ︙ |