97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
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):
"write file <spfSrc> as <spfDst> with variables filed with <dVars>"
s = Template(open(spfSrc, "r", encoding="utf-8").read()).safe_substitute(dVars)
open(spfDst, "w", encoding="utf-8", newline="\n").write(s)
def addFolderToZipAndFileFile (hZip, spSrc, spDst, dVars, bRecursive):
"add folder content to zip archive and file files with <dVars>"
# recursive function
spSrc = spSrc.strip("/ ")
spDst = spDst.strip("/ ")
|
|
|
|
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
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):
"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 addFolderToZipAndFileFile (hZip, spSrc, spDst, dVars, bRecursive):
"add folder content to zip archive and file files with <dVars>"
# recursive function
spSrc = spSrc.strip("/ ")
spDst = spDst.strip("/ ")
|