moved url to definition.py

This commit is contained in:
raphael60650 2021-06-19 22:08:19 +02:00
parent ffb75f868d
commit 7db29fc9bd
3 changed files with 6 additions and 3 deletions

View file

@ -5,7 +5,7 @@ import json
import sys import sys
import os import os
VERSION_FILE_URL = "https://raw.githubusercontent.com/Faraphel/MKWF-Install/master/version" from .definition import *
def check_update(self): def check_update(self):

View file

@ -1,5 +1,8 @@
CREATE_NO_WINDOW = 0x08000000 CREATE_NO_WINDOW = 0x08000000
VERSION = "0.8.1" VERSION = "0.8.1"
GITHUB_REPOSITORY = "Faraphel/MKWF-Install"
GITHUB_CONTENT_ROOT = f"https://raw.githubusercontent.com/{GITHUB_REPOSITORY}/master/"
VERSION_FILE_URL = GITHUB_CONTENT_ROOT + "version"
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]

View file

@ -1,7 +1,7 @@
import requests import requests
import os import os
root = "https://raw.githubusercontent.com/Faraphel/MKWF-Install/master/" from .definition import *
def get_github_file(self, file): def get_github_file(self, file):
@ -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(root+file, allow_redirects=True, stream=True) dl = requests.get(GITHUB_CONTENT_ROOT+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