forked from merwin-asm/UFT
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
installer.py
72 lines (62 loc) · 2.03 KB
/
installer.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import pyPath
import os
USER = os.getlogin()
os.system("pip install -r requirements.txt")
print("\n If you got any errors here , try running : pip3 install -r requirements.txt \n\n")
target_install = f"/home/{USER}/UFT"
def delete_uft_dir():
for e in os.listdir(target_install):
os.remove(f"{target_install}/{e}")
if os.path.exists(target_install):
cmd = input("UFT have been already installed. Do You want to uninstall then enter `y` , if you want to make no change enter `n` , if you want a reinstall enter `t`. [y/n/t] ?")
if cmd == "y":
delete_uft_dir()
os.rmdir(target_install)
os.remove("/usr/bin/uft")
elif cmd == "n":
pass
elif cmd == "t":
delete_uft_dir()
os.rmdir(target_install)
os.remove("/usr/bin/uft")
for e in os.listdir():
try:
f_p = open(f"{target_install}/{e}", "w")
f_c = open(f"{e}", "r")
f_p.write(f_c.read())
f_p.close()
f_c.close()
except:
pass
my_path = pyPath.MYPATH()
my_path.make_redirecting_bashfile(
"uft",
target_pyfile=f"/home/{USER}/UFT/main.py",
allow_args=True,
max_num_args=1000
)
my_path.addfile_to_path(f"{target_install}/uft",
"uft",
exe=True)
else:
os.mkdir(target_install)
for e in os.listdir():
try:
f_p = open(f"{target_install}/{e}","w")
f_c = open(f"{e}","r")
f_p.write(f_c.read())
f_p.close()
f_c.close()
except:
pass
my_path = pyPath.MYPATH()
my_path.make_redirecting_bashfile(
"uft",
target_pyfile=f"/home/{USER}/UFT/main.py",
allow_args=True,
max_num_args=5
)
my_path.addfile_to_path(f"{target_install}/uft",
"uft",
exe=True)
print("Thankyou for Installing , From UFT creators.")