ajout système auto-update
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/update.exe
|
32
auto_update.py
Normal file
32
auto_update.py
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
from version import *
|
||||||
|
import urllib.request
|
||||||
|
import ssl
|
||||||
|
import io
|
||||||
|
|
||||||
|
|
||||||
|
def clean(str):
|
||||||
|
str = str.replace('/','')
|
||||||
|
str = str.replace(':', '')
|
||||||
|
str = str.replace('{', '')
|
||||||
|
str = str.replace('(', '')
|
||||||
|
str = str.replace("\\", '')
|
||||||
|
return str
|
||||||
|
|
||||||
|
def new_update_available():
|
||||||
|
ret = False
|
||||||
|
ctx = ssl.create_default_context()
|
||||||
|
ctx.check_hostname = False
|
||||||
|
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)
|
||||||
|
dl_version = str(data.read()).replace('b', '').replace("'", "")
|
||||||
|
|
||||||
|
ssl._create_default_https_context = ssl._create_unverified_context
|
||||||
|
if dl_version != VERSION:
|
||||||
|
print(f"Version différente trouvée {dl_version} téléchargement en cours")
|
||||||
|
urllib.request.urlretrieve(url=f"https://gitea.prod.resk-u.ch/CLERC/AttribWinbiz/releases/download/{clean(dl_version)}/Clercattrib2Biz_setup.exe", filename="update.exe")
|
||||||
|
ret = True
|
||||||
|
return ret
|
||||||
|
|
||||||
|
|
||||||
|
|
@@ -1 +1 @@
|
|||||||
202200606-1107
|
20220606-1330
|
9
main.py
9
main.py
@@ -3,6 +3,7 @@ import json
|
|||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
import shutil
|
import shutil
|
||||||
|
import subprocess
|
||||||
import textwrap
|
import textwrap
|
||||||
import time
|
import time
|
||||||
import uuid
|
import uuid
|
||||||
@@ -18,8 +19,9 @@ from threading import *
|
|||||||
|
|
||||||
from class_invoices import *
|
from class_invoices import *
|
||||||
from class_addresses import *
|
from class_addresses import *
|
||||||
|
from auto_update import *
|
||||||
|
|
||||||
VERSION = "202200602 - 1700"
|
from version import *
|
||||||
#test master 2
|
#test master 2
|
||||||
|
|
||||||
src_dir = os.getenv('APPDATA') + "\Attrib2Biz\src"
|
src_dir = os.getenv('APPDATA') + "\Attrib2Biz\src"
|
||||||
@@ -250,6 +252,11 @@ class ClercAttrib2Biz():
|
|||||||
|
|
||||||
self.thread = Thread(target=self.start_parsing)
|
self.thread = Thread(target=self.start_parsing)
|
||||||
|
|
||||||
|
if new_update_available():
|
||||||
|
if messagebox.askyesno(title="Nouvelle version trouvée", message=f"Une nouvelle version a été trouvée, vous pouvez l'installer dès maintenant !", ):
|
||||||
|
subprocess.call("update.exe")
|
||||||
|
self.fenetre.destroy()
|
||||||
|
|
||||||
def draw_addressesWindows(self):
|
def draw_addressesWindows(self):
|
||||||
|
|
||||||
# Init de la fenêtre addresses prompt
|
# Init de la fenêtre addresses prompt
|
||||||
|
@@ -1 +1 @@
|
|||||||
VERSION = "202200602 - 1700"
|
VERSION = "20220606-1330"
|
Reference in New Issue
Block a user