-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathupdate.py
36 lines (26 loc) · 1 KB
/
update.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# update app script
# allows for updating the app to the latest version
# by oran collins
# github.com/wisehackermonkey
# 20200526
import logging
# location of server address, app version number
from client_config import ClientConfig
from pyupdater.client import Client, AppUpdate, LibUpdate
# goes to webserver grabs newest version of app and
# replaces the exe with the new one
def check_for_update():
print("[check_for_update]")
logging.basicConfig(level=logging.DEBUG)
client = Client(ClientConfig(), refresh=True)
app_update = client.update_check(ClientConfig.APP_NAME, ClientConfig.APP_VERSION)
if app_update is not None: # is there a new update
if app_update.download(): # the update download is made here
if isinstance(app_update, AppUpdate): # you should freeze it
app_update.extract_restart()
return True
else:
app_update.extract()
return True
return False