46 lines
1.3 KiB
Python
46 lines
1.3 KiB
Python
|
import tarfile, io, shutil, os
|
||
|
try: import urllib.request as ulr
|
||
|
except: import urllib2 as ulr
|
||
|
|
||
|
try:
|
||
|
import androidhelper
|
||
|
platform = "Android"
|
||
|
except:
|
||
|
try:
|
||
|
import objc_util
|
||
|
platform = "iOS"
|
||
|
except:
|
||
|
platform = "other"
|
||
|
quit()
|
||
|
|
||
|
if platform == "Android":
|
||
|
archPath = "/sdcard/qpython/scripts3/tmp"
|
||
|
biblPath = "/sdcard/qpython/lib/python3.2/site-packages"
|
||
|
exmpPath = "/sdcard/qpython/scripts3/Beispiele"
|
||
|
elif platform == "iOS":
|
||
|
archPath = os.path.expanduser("~/Documents/tmp")
|
||
|
biblPath = os.path.expanduser("~/Documents/site-packages")
|
||
|
exmpPath = os.path.expanduser("~/Documents/Examples")
|
||
|
|
||
|
shutil.rmtree(exmpPath + "/velamentum", True)
|
||
|
shutil.rmtree(biblPath + "/velamentum", True)
|
||
|
|
||
|
if not os.path.exists(archPath): os.makedirs(archPath)
|
||
|
if not os.path.exists(biblPath): os.makedirs(biblPath)
|
||
|
if not os.path.exists(exmpPath): os.makedirs(exmpPath)
|
||
|
|
||
|
arch = tarfile.open(fileobj=io.BytesIO(ulr.urlopen("https://dev.spittank.org/mobile/velamentum/repository/archive.tar.gz?ref=master").read()))
|
||
|
|
||
|
cmid = arch.getnames()[0]
|
||
|
|
||
|
arch.extractall(path=archPath)
|
||
|
|
||
|
vsrcPath = archPath + "/" + cmid + "/source/"
|
||
|
|
||
|
shutil.move(vsrcPath + platform, biblPath + '/velamentum')
|
||
|
shutil.move(vsrcPath + "Examples", exmpPath + '/velamentum')
|
||
|
|
||
|
shutil.rmtree(archPath, True)
|
||
|
|
||
|
print("Die aktuelle Version von Velamentum wurde installiert. Bitte die App neu starten.")
|