32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
print("> unzip in: "+ spDest)
spInstall = os.path.abspath(spDest)
if os.path.isdir(spInstall):
eraseFolder(spInstall)
with zipfile.ZipFile(spfZip) as hZip:
hZip.extractall(spDest)
else:
print("# folder not found")
else:
print("path destination is empty")
def eraseFolder (sp):
"erase content of a folder"
for sf in os.listdir(sp):
|
|
|
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
print("> unzip in: "+ spDest)
spInstall = os.path.abspath(spDest)
if os.path.isdir(spInstall):
eraseFolder(spInstall)
with zipfile.ZipFile(spfZip) as hZip:
hZip.extractall(spDest)
else:
print("# folder <" + spDest + "> not found")
else:
print("path destination is empty")
def eraseFolder (sp):
"erase content of a folder"
for sf in os.listdir(sp):
|
92
93
94
95
96
97
98
99
100
101
102
|
for sf in os.listdir(spSrc):
spfSrc = (spSrc + "/" + sf).strip("/ ")
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")):
hZip.writestr(spfDst, fileFile(spfSrc, dVars))
else:
hZip.write(spfSrc, spfDst)
|
|
|
92
93
94
95
96
97
98
99
100
101
102
|
for sf in os.listdir(spSrc):
spfSrc = (spSrc + "/" + sf).strip("/ ")
spfDst = (spDst + "/" + sf).strip("/ ")
if os.path.isdir(spfSrc):
if bRecursive:
addFolderToZipAndFileFile(hZip, spfSrc, spfDst, dVars, bRecursive)
else:
if spfSrc.endswith((".py", ".js", ".json", ".css", ".xcu", ".xul", ".rdf", ".dtd", ".properties")):
hZip.writestr(spfDst, fileFile(spfSrc, dVars))
else:
hZip.write(spfSrc, spfDst)
|