mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Added self-updater script
This commit is contained in:
parent
dd73eae522
commit
28f85300fe
29
updater.py
Normal file
29
updater.py
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import urllib.request
|
||||||
|
import shutil
|
||||||
|
import tempfile
|
||||||
|
import zipfile
|
||||||
|
import distutils.dir_util
|
||||||
|
#import os
|
||||||
|
|
||||||
|
SOURCE_URL = "https://github.com/krateng/maloja/archive/master.zip"
|
||||||
|
|
||||||
|
|
||||||
|
update()
|
||||||
|
|
||||||
|
def update():
|
||||||
|
print("Updating Maloja...")
|
||||||
|
with urllib.request.urlopen(SOURCE_URL) as response:
|
||||||
|
with tempfile.NamedTemporaryFile(delete=True) as tmpfile:
|
||||||
|
shutil.copyfileobj(response,tmpfile)
|
||||||
|
|
||||||
|
with zipfile.ZipFile(tmpfile.name,"r") as z:
|
||||||
|
|
||||||
|
for f in z.namelist():
|
||||||
|
print("extracting " + f)
|
||||||
|
z.extract(f)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
distutils.dir_util.copy_tree("./maloja-master/","./",verbose=2)
|
||||||
|
shutil.rmtree("./maloja-master")
|
||||||
|
print("Done!")
|
Loading…
x
Reference in New Issue
Block a user