Added all files for update support

This commit is contained in:
raphael60650 2021-05-21 14:00:56 +02:00
parent 0b6c3e252f
commit 1aa92aab2a
5 changed files with 65 additions and 0 deletions

33
Updater/Updater.py Normal file
View file

@ -0,0 +1,33 @@
import requests
import zipfile
import os
import sys
Dir, ext = os.path.splitext(sys.argv[0])
if ext == ".py":
input("Ce code ne doit être lancé que sous sa forme .exe !")
exit()
VERSION_FILE_URL = "https://raw.githubusercontent.com/Faraphel/MKWF-Install/master/version"
try:
gitversion = requests.get(VERSION_FILE_URL, allow_redirects=True).json()
URL = gitversion["download_bin"]
dl = requests.get(URL, allow_redirects=True)
with open("./download.zip", "wb") as file:
print(f"Téléchargement de la version {gitversion['version']}.{gitversion['subversion']} en cours...")
file.write(dl.content)
print("fin du téléchargement, début de l'extraction...")
with zipfile.ZipFile("./download.zip") as file:
file.extractall("./")
print("fin de l'extraction")
os.remove("./download.zip")
print("lancement de l'application...")
os.startfile(os.path.realpath("./MKWF-Install.exe"))
except Exception as e:
print(f"Impossible d'effectuer la mise à jour :\n\n{str(e)}")
input("Appuyez pour continuer...")

BIN
Updater/Updater.zip Normal file

Binary file not shown.

1
Updater/build.bat Normal file
View file

@ -0,0 +1 @@
"../venv/Scripts/python.exe" "./setup.py" build

24
Updater/setup.py Normal file
View file

@ -0,0 +1,24 @@
from cx_Freeze import setup, Executable
options = {
"build_exe":{
"includes": ["requests"],
"packages": [],
"excludes": []
}
}
setup(
options=options,
name='MKWF-Install',
version='0.3',
url='https://github.com/Faraphel/MKWF-Install',
license='GPL-3.0',
author='Faraphel',
author_email='rc60650@hotmail.com',
description='Logiciel de mise à jour pour MKWF-Install.',
executables = [Executable("./Updater.py",
target_name = "Updater.exe",
shortcut_name = "MKWF-Install Updater",
shortcut_dir = "DesktopFolder")],
)

7
version Normal file
View file

@ -0,0 +1,7 @@
{
"version": "0.1",
"subversion": "0",
"changelog": "",
"download_bin": "https://github.com/Faraphel/MKWF-Install/releases/download/0.1/MKWF.v0.1.zip",
"updater_bin": "https://github.com/Faraphel/MKWF-Install/raw/master/Updater/Updater.zip"
}