débug auto-update

This commit is contained in:
Ambulance Clerc
2023-12-01 17:21:08 +01:00
parent f2422762d2
commit 32c8a5ca3f
4 changed files with 31 additions and 24 deletions

View File

@@ -1,5 +1,6 @@
from version import *
import urllib.request
import urllib.error
import ssl
import io
@@ -22,15 +23,22 @@ class auto_updater:
ctx.verify_mode = ssl.CERT_NONE
data = urllib.request.urlopen("https://gitea.prod.resk-u.ch/CLERC/AttribWinbiz/raw/branch/master/dl_version", context=ctx)
self.dl_version = str(data.read()).replace('b', '').replace("'", "")
self.dl_version = str(data.read()).replace('b', '').replace("'", "").replace("\n","").replace('n',"")
ssl._create_default_https_context = ssl._create_unverified_context
if self.dl_version != VERSION:
print(f"Version différente trouvée {self.dl_version} téléchargement en cours => {self.temp_dir}update.exe")
print(f"Version différente trouvée {self.dl_version} téléchargement en cours => {self.temp_dir}clerc_update.exe")
try:
urllib.request.urlretrieve(url=f"https://gitea.prod.resk-u.ch/CLERC/AttribWinbiz/releases/download/{self.clean(self.dl_version)}/Clercattrib2Biz_setup.exe", filename=f"{self.temp_dir}update.exe")
except:
print("ERREUR de téléchargement mise à jours")
url = f"https://gitea.prod.resk-u.ch/CLERC/AttribWinbiz/releases/download/{self.clean(self.dl_version)}/Clercattrib2Biz_setup.exe"
urllib.request.urlretrieve(url=url, filename=f"{self.temp_dir}clerc_update.exe")
except urllib.error.URLError as e:
print(f"ERREUR de téléchargement mise à jour : {e.reason} \n {url}")
return "ERROR"
except urllib.error.HTTPError as e:
print(f"ERREUR HTTP lors du téléchargement : {e.code} {e.reason} \n {url}")
return "ERROR"
except Exception as e:
print(f"Erreur inattendue : {e} \n {url}")
return "ERROR"
ret = True
return ret