Updater
This commit is contained in:
5
build_bats/build-updater.bat
Normal file
5
build_bats/build-updater.bat
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
cd ..
|
||||||
|
pip install -r requirements.txt
|
||||||
|
pyinstaller --noconfirm --icon "img/icon.ico" --onefile --console "horsy_updater.py"
|
||||||
|
rmdir /s /q __pycache__
|
||||||
|
del horsy_updater.spec
|
||||||
7
build_bats/build-updater_clean.bat
Normal file
7
build_bats/build-updater_clean.bat
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
cd ..
|
||||||
|
pip install -r requirements.txt
|
||||||
|
rmdir /s /q build
|
||||||
|
pyinstaller --noconfirm --icon "img/icon.ico" --onefile --console "horsy_updater.py"
|
||||||
|
rmdir /s /q __pycache__
|
||||||
|
del horsy_updater.spec
|
||||||
|
rmdir /s /q build
|
||||||
1
dist.py
1
dist.py
@@ -3,6 +3,7 @@ import os
|
|||||||
os.system("xcopy /s /Y dist\horsy.exe bin\horsy.exe*")
|
os.system("xcopy /s /Y dist\horsy.exe bin\horsy.exe*")
|
||||||
os.system("xcopy /s /Y dist\horsygui.exe bin\horsygui.exe*")
|
os.system("xcopy /s /Y dist\horsygui.exe bin\horsygui.exe*")
|
||||||
os.system("xcopy /s /Y dist\horsy_installer.exe bin\installer-horsy-win.exe*")
|
os.system("xcopy /s /Y dist\horsy_installer.exe bin\installer-horsy-win.exe*")
|
||||||
|
os.system("xcopy /s /Y dist\horsy_updater.exe bin\horsy_updater.exe*")
|
||||||
|
|
||||||
with open("web_vars/version", "r") as f_r:
|
with open("web_vars/version", "r") as f_r:
|
||||||
version = f_r.readline()
|
version = f_r.readline()
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ def install():
|
|||||||
ui.logs_box.append("Adding task to download horsygui")
|
ui.logs_box.append("Adding task to download horsygui")
|
||||||
threads.append(threading.Thread(target=urllib.request.urlretrieve,
|
threads.append(threading.Thread(target=urllib.request.urlretrieve,
|
||||||
args=("https://github.com/BarsTiger/horsy/raw/master/bin/horsygui.exe",
|
args=("https://github.com/BarsTiger/horsy/raw/master/bin/horsygui.exe",
|
||||||
os.path.join(path_to_install) + '/horsy.exe'), ))
|
os.path.join(path_to_install) + '/horsygui.exe'), ))
|
||||||
try:
|
try:
|
||||||
ui.logs_box.append("Starting tasks")
|
ui.logs_box.append("Starting tasks")
|
||||||
for thread in threads:
|
for thread in threads:
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
import argparse
|
||||||
|
import urllib.request
|
||||||
|
import threading
|
||||||
|
import ctypes
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser(description='horsy updater')
|
||||||
|
parser.add_argument('option', nargs='?')
|
||||||
|
args = parser.parse_args()
|
||||||
|
option = args.option
|
||||||
|
|
||||||
|
path_to_install = os.popen('echo %HORSYPATH%').read().replace('\n', '') # Get installation folder
|
||||||
|
|
||||||
|
if not os.path.exists(path_to_install):
|
||||||
|
os.makedirs(path_to_install)
|
||||||
|
if not os.path.exists(path_to_install + "\\apps"):
|
||||||
|
os.makedirs(path_to_install + "\\apps")
|
||||||
|
threads = list()
|
||||||
|
threads.append(threading.Thread(target=urllib.request.urlretrieve,
|
||||||
|
args=("https://github.com/BarsTiger/horsy/raw/master/bin/horsy.exe",
|
||||||
|
os.path.join(path_to_install) + '/horsy.exe'), ))
|
||||||
|
if os.path.exists(path_to_install + '/horsygui.exe'):
|
||||||
|
threads.append(threading.Thread(target=urllib.request.urlretrieve,
|
||||||
|
args=("https://github.com/BarsTiger/horsy/raw/master/bin/horsygui.exe",
|
||||||
|
os.path.join(path_to_install) + '/horsygui.exe'), ))
|
||||||
|
try:
|
||||||
|
for thread in threads:
|
||||||
|
thread.start()
|
||||||
|
except:
|
||||||
|
ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, " ".join(sys.argv), None, 1)
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
urllib.request.urlretrieve("https://github.com/BarsTiger/horsy/raw/master/web_vars/version",
|
||||||
|
os.path.join(path_to_install) + '/apps/version')
|
||||||
|
|
||||||
|
for thread in threads:
|
||||||
|
thread.join()
|
||||||
|
|
||||||
|
os.system(option)
|
||||||
|
|||||||
Reference in New Issue
Block a user