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 = CT_Config()
|
||||||
self.ctconfig.load_ctconfig_file("./ct_config.json")
|
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_language = StringVar(value=self.option["language"])
|
||||||
self.stringvar_game_format = StringVar(value=self.option["format"])
|
self.stringvar_game_format = StringVar(value=self.option["format"])
|
||||||
self.boolvar_disable_download = BooleanVar(value=self.option["disable_download"])
|
self.boolvar_disable_download = BooleanVar(value=self.option["disable_download"])
|
||||||
|
@ -36,8 +37,6 @@ def __init__(self):
|
||||||
self.root.iconbitmap(bitmap="./icon.ico")
|
self.root.iconbitmap(bitmap="./icon.ico")
|
||||||
|
|
||||||
if not(self.boolvar_dont_check_for_update.get()): self.check_update()
|
if not(self.boolvar_dont_check_for_update.get()): self.check_update()
|
||||||
self.path_mkwf = None
|
|
||||||
|
|
||||||
|
|
||||||
self.menu_bar = Menu(self.root)
|
self.menu_bar = Menu(self.root)
|
||||||
self.root.config(menu=self.menu_bar)
|
self.root.config(menu=self.menu_bar)
|
||||||
|
|
|
@ -13,8 +13,8 @@ def check_update(self):
|
||||||
with open("./version", "rb") as f:
|
with open("./version", "rb") as f:
|
||||||
locversion = json.load(f)
|
locversion = json.load(f)
|
||||||
|
|
||||||
if ((float(gitversion["version"]) > float(locversion["version"])) or
|
if ((float(gitversion["version"]) > float(locversion["version"])) or # if github version is newer than
|
||||||
(float(gitversion["version"]) == float(locversion["version"])) and
|
(float(gitversion["version"]) == float(locversion["version"])) and # local version
|
||||||
float(gitversion["subversion"]) > float(locversion["subversion"])):
|
float(gitversion["subversion"]) > float(locversion["subversion"])):
|
||||||
if messagebox.askyesno(
|
if messagebox.askyesno(
|
||||||
self.translate("Update available !"),
|
self.translate("Update available !"),
|
||||||
|
@ -38,6 +38,11 @@ def check_update(self):
|
||||||
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
|
||||||
|
(float(gitversion["version"]) == float(locversion["version"])) and # github version
|
||||||
|
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"),
|
||||||
self.translate("Can't connect to internet. Download will be disabled."))
|
self.translate("Can't connect to internet. Download will be disabled."))
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
CREATE_NO_WINDOW = 0x08000000
|
CREATE_NO_WINDOW = 0x08000000
|
||||||
GITHUB_REPOSITORY = "Faraphel/MKWF-Install"
|
GITHUB_REPOSITORY = "Faraphel/MKWF-Install"
|
||||||
GITHUB_CONTENT_ROOT = f"https://raw.githubusercontent.com/{GITHUB_REPOSITORY}/master/"
|
GITHUB_MASTER_BRANCH = f"https://raw.githubusercontent.com/{GITHUB_REPOSITORY}/master/"
|
||||||
VERSION_FILE_URL = GITHUB_CONTENT_ROOT + "version"
|
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_filename = lambda file: ".".join(file.split(".")[:-1])
|
||||||
get_nodir = lambda file: file.replace("\\", "/").split("/")[-1]
|
get_nodir = lambda file: file.replace("\\", "/").split("/")[-1]
|
||||||
|
|
|
@ -9,7 +9,7 @@ def get_github_file(self, file):
|
||||||
returncode = 0
|
returncode = 0
|
||||||
if self.boolvar_disable_download.get(): return 2
|
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 os.path.exists(file):
|
||||||
if int(dl.headers['Content-Length']) == os.path.getsize(file): return 1
|
if int(dl.headers['Content-Length']) == os.path.getsize(file): return 1
|
||||||
else: returncode = 3
|
else: returncode = 3
|
||||||
|
|
|
@ -133,3 +133,5 @@ def install_mod(self):
|
||||||
t.setDaemon(True)
|
t.setDaemon(True)
|
||||||
t.start()
|
t.start()
|
||||||
return t
|
return t
|
||||||
|
|
||||||
|
# TODO: use wszst module instead of subprocess
|
||||||
|
|
Loading…
Reference in a new issue