-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheckForNewVersion.py
More file actions
48 lines (36 loc) · 1.17 KB
/
checkForNewVersion.py
File metadata and controls
48 lines (36 loc) · 1.17 KB
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
37
38
39
40
41
42
43
44
45
46
import os
import subprocess
import requests
import re
import jdk
version_regex = r"(?<=Release Version )\d+\.\d+"
release_url = "https://github.com/TSerious/QuickFioriTimeEvents/releases/latest"
def get_latest_version() -> str:
response = requests.get(release_url)
match = re.search(version_regex, response.text)
if not match:
return ""
return match.group(0)
def get_installed_java_version():
try:
p = subprocess.Popen("java -version",
stdout = subprocess.PIPE,
stderr = subprocess.STDOUT)
javaVersion = iter(p.stdout.readline, b'')
return list(javaVersion)
except:
return ''
print(f"Current version is: {get_latest_version()}")
print(f"The currently installed java version is: {get_installed_java_version()}")
installJave = input('Install java? [y/n]')
if installJave == 'y':
jdk.install('11', jre=True)
else:
print("Java wasn't installed")
installDriver = input('Install chrome driver? [y/n]')
if installDriver == 'y':
os.system('java -jar webdrivermanager-5.3.2-fat.jar resolveDriverFor chrome')
else:
print("Driver wasn't installed")
print("Press any key to exit...")
input()