Grammalecte  Check-in [22d07b42b2]

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: 22d07b42b27b3b1b55e86a28f9f18d107555b64ca9a874bcd7ef8c18fd70df79
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: fr, trunk
09:04
[build] move generated web-extension from deep folder to _build check-in: 22d07b42b2 user: olr tags: build, trunk
08:03
[build] change build option for Firefox Nightly check-in: f1955d65d4 user: olr tags: build, trunk
Changes

Modified gc_lang/fr/build.py from [aa2383a06d] to [55ae0943c1].

    23     23       dir_util.copy_tree("gc_lang/"+sLang+"/webext/", "_build/webext/"+sLang)
    24     24       dir_util.copy_tree("grammalecte-js", "_build/webext/"+sLang+"/grammalecte")
    25     25       dVars['webextOptionsHTML'] = _createOptionsForWebExtension(dVars)
    26     26       helpers.copyAndFileTemplate("_build/webext/"+sLang+"/manifest.json", "_build/webext/"+sLang+"/manifest.json", dVars)
    27     27       helpers.copyAndFileTemplate("_build/webext/"+sLang+"/panel/main.html", "_build/webext/"+sLang+"/panel/main.html", dVars)
    28     28       with helpers.CD("_build/webext/"+sLang):
    29     29           os.system("web-ext build")
           30  +    # Copy Firefox zip extension to _build
           31  +    helpers.moveFolderContent("_build/webext/"+sLang+"/web-ext-artifacts", "_build", "fx-"+sLang+"-", True)
    30     32   
    31     33   
    32     34   def _createOptionsForWebExtension (dVars):
    33     35       sHTML = ""
    34     36       sLang = dVars['sDefaultUILang']
    35     37       for sSection, lOpt in dVars['lStructOpt']:
    36     38           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     68           shutil.copytree(spSrc, spDst)
    69     69       except OSError as e:
    70     70           if e.errno == errno.ENOTDIR:
    71     71               shutil.copy(spSrc, spDst)
    72     72           else:
    73     73               raise
    74     74   
           75  +
           76  +def moveFolderContent (spSrc, spDst, sPrefix="", bLog=False):
           77  +    "move folder content from <spSrc> to <spDst>: if files already exist in <spDst>, they are replaced. (not recursive)"
           78  +    try:
           79  +        for sf in os.listdir(spSrc):
           80  +            spfSrc = os.path.join(spSrc, sf)
           81  +            if os.path.isfile(spfSrc):
           82  +                spfDst = os.path.join(spDst, sPrefix + sf)
           83  +                shutil.move(spfSrc, spfDst)
           84  +                if bLog:
           85  +                    print("file <" + spfSrc + "> moved to <"+spfDst+">")
           86  +    except:
           87  +        raise
           88  +
    75     89   
    76     90   def fileFile (spf, dVars):
    77     91       "return file <spf> as a text filed with variables from <dVars>"
    78     92       return Template(open(spf, "r", encoding="utf-8").read()).safe_substitute(dVars)
    79     93   
    80     94   
    81     95   def copyAndFileTemplate (spfSrc, spfDst, dVars):