mirror of
https://github.com/Faraphel/Atlas-Install.git
synced 2025-07-04 03:38:26 +02:00
next version will be 0.10.0, version will be checked with from distutils.version.StrictVersion, so that it is simpler to check. Also fix an issue where 0.10 is less than 0.9
This commit is contained in:
parent
738e0b101b
commit
ebca6c3335
2 changed files with 19 additions and 19 deletions
|
@ -1,12 +1,15 @@
|
||||||
from tkinter import filedialog, ttk
|
from distutils.version import StrictVersion
|
||||||
|
from tkinter import filedialog, ttk, messagebox
|
||||||
from tkinter import *
|
from tkinter import *
|
||||||
import subprocess
|
import subprocess
|
||||||
import traceback
|
import traceback
|
||||||
import requests
|
import requests
|
||||||
import zipfile
|
import zipfile
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
|
||||||
|
from source.Game import Game, RomAlreadyPatched, InvalidGamePath, InvalidFormat, in_thread, VERSION_FILE_URL
|
||||||
from source.Option import Option
|
from source.Option import Option
|
||||||
from source.Game import *
|
|
||||||
|
|
||||||
|
|
||||||
with open("./translation.json", encoding="utf-8") as f:
|
with open("./translation.json", encoding="utf-8") as f:
|
||||||
|
@ -189,22 +192,21 @@ class Gui:
|
||||||
Check if an update is available
|
Check if an update is available
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
gitversion = requests.get(VERSION_FILE_URL, allow_redirects=True).json()
|
github_version_data = requests.get(VERSION_FILE_URL, allow_redirects=True).json()
|
||||||
with open("./version", "rb") as f:
|
with open("./version", "rb") as f: local_version_data = json.load(f)
|
||||||
locversion = json.load(f)
|
|
||||||
|
|
||||||
if ((float(gitversion["version"]) > float(locversion["version"])) or # if github version is newer than
|
local_version = StrictVersion(f"{local_version_data['version']}.{local_version_data['subversion']}")
|
||||||
(float(gitversion["version"]) == float(locversion["version"])) and # local version
|
github_version = StrictVersion(f"{github_version_data['version']}.{github_version_data['subversion']}")
|
||||||
float(gitversion["subversion"]) > float(locversion["subversion"])):
|
|
||||||
|
if github_version > local_version: # if github version is newer than local version
|
||||||
if messagebox.askyesno(
|
if messagebox.askyesno(
|
||||||
self.translate("Update available !"),
|
self.translate("Update available !"),
|
||||||
self.translate("An update is available, do you want to install it ?",
|
self.translate("An update is available, do you want to install it ?",
|
||||||
f"\n\nVersion : {locversion['version']}.{locversion['subversion']} -> "
|
f"\n\nVersion : {local_version} -> {github_version}\n"
|
||||||
f"{gitversion['version']}.{gitversion['subversion']}\n"
|
f"Changelog :\n{github_version_data['changelog']}")):
|
||||||
f"Changelog :\n{gitversion['changelog']}")):
|
|
||||||
|
|
||||||
if not (os.path.exists("./Updater/Updater.exe")):
|
if not (os.path.exists("./Updater/Updater.exe")):
|
||||||
dl = requests.get(gitversion["updater_bin"], allow_redirects=True)
|
dl = requests.get(github_version_data["updater_bin"], allow_redirects=True)
|
||||||
with open("./download.zip", "wb") as file:
|
with open("./download.zip", "wb") as file:
|
||||||
print(self.translate("Downloading the Updater..."))
|
print(self.translate("Downloading the Updater..."))
|
||||||
file.write(dl.content)
|
file.write(dl.content)
|
||||||
|
@ -218,10 +220,8 @@ class Gui:
|
||||||
print(self.translate("starting application..."))
|
print(self.translate("starting application..."))
|
||||||
os.startfile(os.path.realpath("./Updater/Updater.exe"))
|
os.startfile(os.path.realpath("./Updater/Updater.exe"))
|
||||||
|
|
||||||
if ((float(gitversion["version"]) < float(locversion["version"])) or # if local version is newer than
|
elif local_version > github_version:
|
||||||
(float(gitversion["version"]) == float(locversion["version"])) and # github version
|
self.is_dev_version = True
|
||||||
float(gitversion["subversion"]) < float(locversion["subversion"])):
|
|
||||||
self.is_dev_version = True
|
|
||||||
|
|
||||||
except requests.ConnectionError:
|
except requests.ConnectionError:
|
||||||
messagebox.showwarning(self.translate("Warning"),
|
messagebox.showwarning(self.translate("Warning"),
|
||||||
|
|
6
version
6
version
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"version": "0.9",
|
"version": "0.10",
|
||||||
"subversion": "0",
|
"subversion": "0",
|
||||||
"changelog": "- Updated GBA Sky Garden, Quag Beach -> Pokemon Beach, Rainbow Mountain Fortress, Sarasa Kingdom, Sunset Sewer, Torrential Flood Lake, Red Sector B -> Red Sector A.\n- Added 33 new tracks.\n\n- Added a page in the github wiki about forking the project to make your own ISO patcher based on MKWF-Install (https://github.com/Faraphel/MKWF-Install/wiki/Customizing-the-installer)\n- Reworked translation code.\n- English is now used in the program instead of French to make the code easier to read for everyone !\n- Reworked prefix and suffix code, now only them can be colored (the name will no longer be colored if it contains N64 for example)\n\n- You can now color track from a specific version (for example, if you only want to play on new track)\n- Added a \"track selection\" menu allowing you to only patch game for track with a certain amount of stars. (This does not apply for track from other Mario Kart like SNES, GBA, GCN, ...)\n\n- An error occurred with the updater making it unusable. If you had it, please delete ./Updater directory.\n- Fixed an error occurring when trying to update.",
|
"changelog": "",
|
||||||
"download_bin": "https://github.com/Faraphel/MKWF-Install/releases/download/0.9/MKWF.v0.9.zip",
|
"download_bin": "https://github.com/Faraphel/MKWF-Install/releases/download/1.0/MKWF.v1.0.zip",
|
||||||
"updater_bin": "https://github.com/Faraphel/MKWF-Install/raw/master/Updater/Updater.zip"
|
"updater_bin": "https://github.com/Faraphel/MKWF-Install/raw/master/Updater/Updater.zip"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue