1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Worked around VERY strange bug in update script

This commit is contained in:
Krateng 2019-02-18 16:45:36 +01:00
parent b17cfa21b4
commit 28f35aa12a

27
maloja
View File

@ -157,21 +157,28 @@ def update():
import urllib.request import urllib.request
import shutil import shutil
import tempfile #import tempfile
import zipfile import zipfile
import distutils.dir_util import distutils.dir_util
print("Updating Maloja...") print("Updating Maloja...")
with urllib.request.urlopen(SOURCE_URL) as response: #with urllib.request.urlopen(SOURCE_URL) as response:
with tempfile.NamedTemporaryFile(delete=True) as tmpfile: # with tempfile.NamedTemporaryFile(delete=True) as tmpfile:
shutil.copyfileobj(response,tmpfile) # shutil.copyfileobj(response,tmpfile)
#
with zipfile.ZipFile(tmpfile.name,"r") as z: # with zipfile.ZipFile(tmpfile.name,"r") as z:
#
# for f in z.namelist():
# #print("extracting " + f)
# z.extract(f)
os.system("wget " + SOURCE_URL)
with zipfile.ZipFile("master.zip","r") as z:
for f in z.namelist(): for f in z.namelist():
#print("extracting " + f) #print("extracting " + f)
z.extract(f) z.extract(f)
distutils.dir_util.copy_tree("./maloja-master/","./",verbose=2) distutils.dir_util.copy_tree("./maloja-master/","./",verbose=2)