mirror of
https://github.com/Faraphel/Atlas-Install.git
synced 2025-07-05 12:18:21 +02:00
installer will now detect if it is a dev version, and can change url to download track
This commit is contained in:
parent
57efdf2da3
commit
2f171311bc
5 changed files with 20 additions and 11 deletions
|
@ -19,6 +19,7 @@ def __init__(self):
|
|||
self.ctconfig = CT_Config()
|
||||
self.ctconfig.load_ctconfig_file("./ct_config.json")
|
||||
|
||||
self.is_dev_version = False # Is this installer version a dev ?
|
||||
self.stringvar_language = StringVar(value=self.option["language"])
|
||||
self.stringvar_game_format = StringVar(value=self.option["format"])
|
||||
self.boolvar_disable_download = BooleanVar(value=self.option["disable_download"])
|
||||
|
@ -36,8 +37,6 @@ def __init__(self):
|
|||
self.root.iconbitmap(bitmap="./icon.ico")
|
||||
|
||||
if not(self.boolvar_dont_check_for_update.get()): self.check_update()
|
||||
self.path_mkwf = None
|
||||
|
||||
|
||||
self.menu_bar = Menu(self.root)
|
||||
self.root.config(menu=self.menu_bar)
|
||||
|
|
|
@ -13,15 +13,15 @@ def check_update(self):
|
|||
with open("./version", "rb") as f:
|
||||
locversion = json.load(f)
|
||||
|
||||
if ((float(gitversion["version"]) > float(locversion["version"])) or
|
||||
(float(gitversion["version"]) == float(locversion["version"])) and
|
||||
if ((float(gitversion["version"]) > float(locversion["version"])) or # if github version is newer than
|
||||
(float(gitversion["version"]) == float(locversion["version"])) and # local version
|
||||
float(gitversion["subversion"]) > float(locversion["subversion"])):
|
||||
if messagebox.askyesno(
|
||||
self.translate("Update available !"),
|
||||
self.translate("An update is available, do you want to install it ?",
|
||||
f"\n\nVersion : {locversion['version']}.{locversion['subversion']} -> "
|
||||
f"{gitversion['version']}.{gitversion['subversion']}\n"
|
||||
f"Changelog :\n{gitversion['changelog']}")):
|
||||
f"\n\nVersion : {locversion['version']}.{locversion['subversion']} -> "
|
||||
f"{gitversion['version']}.{gitversion['subversion']}\n"
|
||||
f"Changelog :\n{gitversion['changelog']}")):
|
||||
|
||||
if not(os.path.exists("./Updater/Updater.exe")):
|
||||
dl = requests.get(gitversion["updater_bin"], allow_redirects=True)
|
||||
|
@ -38,6 +38,11 @@ def check_update(self):
|
|||
print(self.translate("starting application..."))
|
||||
os.startfile(os.path.realpath("./Updater/Updater.exe"))
|
||||
|
||||
if ((float(gitversion["version"]) < float(locversion["version"])) or # if local version is newer than
|
||||
(float(gitversion["version"]) == float(locversion["version"])) and # github version
|
||||
float(gitversion["subversion"]) < float(locversion["subversion"])):
|
||||
self.is_dev_version = True
|
||||
|
||||
except requests.ConnectionError:
|
||||
messagebox.showwarning(self.translate("Warning"),
|
||||
self.translate("Can't connect to internet. Download will be disabled."))
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
CREATE_NO_WINDOW = 0x08000000
|
||||
GITHUB_REPOSITORY = "Faraphel/MKWF-Install"
|
||||
GITHUB_CONTENT_ROOT = f"https://raw.githubusercontent.com/{GITHUB_REPOSITORY}/master/"
|
||||
VERSION_FILE_URL = GITHUB_CONTENT_ROOT + "version"
|
||||
GITHUB_MASTER_BRANCH = f"https://raw.githubusercontent.com/{GITHUB_REPOSITORY}/master/"
|
||||
GITHUB_DEV_BRANCH = f"https://raw.githubusercontent.com/{GITHUB_REPOSITORY}/dev/"
|
||||
VERSION_FILE_URL = GITHUB_MASTER_BRANCH + "version"
|
||||
|
||||
get_github_content_root = lambda self: GITHUB_DEV_BRANCH if self.is_dev_version else GITHUB_MASTER_BRANCH
|
||||
|
||||
get_filename = lambda file: ".".join(file.split(".")[:-1])
|
||||
get_nodir = lambda file: file.replace("\\", "/").split("/")[-1]
|
||||
|
|
|
@ -9,7 +9,7 @@ def get_github_file(self, file):
|
|||
returncode = 0
|
||||
if self.boolvar_disable_download.get(): return 2
|
||||
|
||||
dl = requests.get(GITHUB_CONTENT_ROOT+file, allow_redirects=True, stream=True)
|
||||
dl = requests.get(get_github_content_root(self)+file, allow_redirects=True, stream=True)
|
||||
if os.path.exists(file):
|
||||
if int(dl.headers['Content-Length']) == os.path.getsize(file): return 1
|
||||
else: returncode = 3
|
||||
|
|
|
@ -132,4 +132,6 @@ def install_mod(self):
|
|||
t = Thread(target=func)
|
||||
t.setDaemon(True)
|
||||
t.start()
|
||||
return t
|
||||
return t
|
||||
|
||||
# TODO: use wszst module instead of subprocess
|
||||
|
|
Loading…
Reference in a new issue