Grammalecte  Check-in [7abc9dbabe]

Overview
Comment:[build] add Dockerfile to Grammalecte package
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | build
Files: files | file ages | folders
SHA3-256: 7abc9dbabe9494e70ffebb627467ffd6199bd2b8e12ca34029e3c24723f65dd4
User & Date: olr on 2020-10-10 06:53:37
Other Links: manifest | tags
Context
2020-10-10
13:00
[fr] setup.py update check-in: 6242d45ee1 user: olr tags: trunk, fr
06:53
[build] add Dockerfile to Grammalecte package check-in: 7abc9dbabe user: olr tags: trunk, build
06:50
[fr] ajustements check-in: 181bc9b22c user: olr tags: trunk, fr
Changes

Modified dockerfile.txt from [f391f2d6f4] to [50a9ee9c52].

1
2
3
4
5
6
7
8
9
10
FROM python:3-alpine AS src

ENV VERSION 1.12.2

RUN apk add --update --no-cache \
      unzip \
      wget \
 && wget https://grammalecte.net/grammalecte/zip/Grammalecte-fr-v${VERSION}.zip \
 && unzip Grammalecte-fr-v${VERSION}.zip -d /srv



|







1
2
3
4
5
6
7
8
9
10
FROM python:3-alpine AS src

ENV VERSION ${version}

RUN apk add --update --no-cache \
      unzip \
      wget \
 && wget https://grammalecte.net/grammalecte/zip/Grammalecte-fr-v${VERSION}.zip \
 && unzip Grammalecte-fr-v${VERSION}.zip -d /srv

Modified helpers.py from [55556da673] to [3b783d8a38].

118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
    "write file <spfSrc> as <spfDst> with variables filed with <dVars>"
    sText = Template(open(spfSrc, "r", encoding="utf-8").read()).safe_substitute(dVars)
    open(spfDst, "w", encoding="utf-8", newline="\n").write(sText)


def addFileToZipAndFileFile (hZip, spfSrc, spfDst, dVars):
    "add a file to zip archive and file it with <dVars>"
    if spfSrc.endswith((".py", ".js", ".json", ".html", ".htm", ".css", ".xcu", ".xul", ".rdf", ".dtd", ".properties")):
        hZip.writestr(spfDst, fileFile(spfSrc, dVars))
    else:
        hZip.write(spfSrc, spfDst)


def addFolderToZipAndFileFile (hZip, spSrc, spDst, dVars, bRecursive):
    "add folder content to zip archive and file files with <dVars>"







|







118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
    "write file <spfSrc> as <spfDst> with variables filed with <dVars>"
    sText = Template(open(spfSrc, "r", encoding="utf-8").read()).safe_substitute(dVars)
    open(spfDst, "w", encoding="utf-8", newline="\n").write(sText)


def addFileToZipAndFileFile (hZip, spfSrc, spfDst, dVars):
    "add a file to zip archive and file it with <dVars>"
    if spfSrc.endswith((".txt", ".md", ".py", ".js", ".json", ".html", ".htm", ".css", ".xcu", ".xul", ".rdf", ".dtd", ".properties")):
        hZip.writestr(spfDst, fileFile(spfSrc, dVars))
    else:
        hZip.write(spfSrc, spfDst)


def addFolderToZipAndFileFile (hZip, spSrc, spDst, dVars, bRecursive):
    "add folder content to zip archive and file files with <dVars>"

Modified make.py from [9b2835f8ca] to [f59af684eb].

152
153
154
155
156
157
158


159
160
161
162
163
164
165
166
    "create server zip"
    spfZip = f"_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", \
                "README.txt", "LICENSE.txt", "LICENSE.fr.txt"]:
        hZip.write(spf)


    hZip.writestr("setup.py", helpers.fileFile("gc_lang/fr/setup.py", dVars))


def copyGrammalectePyPackageInZipFile (hZip, spLangPack, sAddPath=""):
    "copy Grammalecte Python package in zip file"
    for sf in os.listdir("grammalecte"):
        if not os.path.isdir("grammalecte/"+sf):
            hZip.write("grammalecte/"+sf, sAddPath+"grammalecte/"+sf)







>
>
|







152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
    "create server zip"
    spfZip = f"_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", \
                "README.txt", "LICENSE.txt", "LICENSE.fr.txt"]:
        hZip.write(spf)
    helpers.addFileToZipAndFileFile(hZip, "dockerfile.txt", "Dockerfile", dVars)
    helpers.addFileToZipAndFileFile(hZip, "gc_lang/fr/setup.py", "setup.py", dVars)
    #hZip.writestr("setup.py", helpers.fileFile("gc_lang/fr/setup.py", dVars))


def copyGrammalectePyPackageInZipFile (hZip, spLangPack, sAddPath=""):
    "copy Grammalecte Python package in zip file"
    for sf in os.listdir("grammalecte"):
        if not os.path.isdir("grammalecte/"+sf):
            hZip.write("grammalecte/"+sf, sAddPath+"grammalecte/"+sf)