-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathupdate.py
32 lines (27 loc) · 1.32 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
import requests
import os
with open("VERSION") as f:
VERSION = f.read().strip()
def self_update():
r_version = requests.get("https://raw.githubusercontent.com/DocSystem/EfreiRPC/master/VERSION")
if r_version.status_code == 200:
new_ver = r_version.text.strip()
if new_ver != VERSION:
print("Une mise à jour de EfreiRPC est disponible !")
print("Mise à jour de EfreiRPC v" + VERSION + " vers v" + new_ver)
r_main = requests.get("https://raw.githubusercontent.com/DocSystem/EfreiRPC/master/main.py")
r_setup = requests.get("https://raw.githubusercontent.com/DocSystem/EfreiRPC/master/setup.py")
r_update = requests.get("https://raw.githubusercontent.com/DocSystem/EfreiRPC/master/update.py")
with open("main.py", "w", encoding="utf-8") as f:
f.write(r_main.text)
with open("setup.py", "w", encoding="utf-8") as f:
f.write(r_setup.text)
with open("update.py", "w", encoding="utf-8") as f:
f.write(r_update.text)
with open("VERSION", "w", encoding="utf-8") as f:
f.write(new_ver)
print("Mise à jour effectuée !")
print("Veuillez relancer EfreiRPC.")
exit(0)
if not os.path.exists(".DEV"):
self_update()