MCPcopy
hub / github.com/DedSecInside/TorBot / check_version

Function check_version

torbot/modules/updater.py:4–27  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2
3
4def check_version():
5
6 try:
7 subprocess.run(["git", "branch"], check=True, capture_output=True)
8 except subprocess.CalledProcessError:
9 subprocess.run(["git", "init"], capture_output=True)
10 subprocess.run(["git", "remote", "add", "origin",
11 "https://github.com/DedSecInside/TorBoT.git"], capture_output=True)
12
13 print("Checking for latest stable release")
14 branch_out = subprocess.run(["git", "rev-parse", "--abbrev-ref", "HEAD"], capture_output=True, text=True)
15 branch = branch_out.stdout
16 if branch == 'master':
17 update_out = subprocess.run(["git", "pull", "origin", "master"], capture_output=True, text=True)
18 if 'Already up to date.' in update_out.stdout:
19 print("TorBot is already up-to-date.")
20 else:
21 print("TorBot has succesfully updated to latest stable version.")
22 else:
23 update_out = subprocess.run(["git", "pull", "origin", "dev"], capture_output=True, text=True)
24 if 'Already up to date.' in update_out.stdout:
25 print("TorBot is already up-to-date.")
26 else:
27 print("TorBot has succesfully updated to latest stable version.")

Callers 1

runFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected