forked from DonTizi/ReMind
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuninstaller.py
47 lines (39 loc) · 1.67 KB
/
uninstaller.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
# Author: Elyes Rayane Melbouci
# Purpose: This script uninstalls the RemindEnchanted application by removing the virtual environment and the associated symlink.
import os
import shutil
from tqdm import tqdm
import subprocess
def run_silent_command(command, progress_bar):
"""Run a command silently without printing output to the console."""
subprocess.run(command, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
progress_bar.update(1)
def remove_venv(venv_path, progress_bar):
"""Remove the virtual environment if it exists."""
progress_bar.set_description("Removing virtual environment")
if os.path.exists(venv_path):
shutil.rmtree(venv_path)
progress_bar.update(1)
print(f"Virtual environment at {venv_path} has been removed.")
else:
progress_bar.update(1)
print(f"No virtual environment found at {venv_path}.")
def remove_symlink(progress_bar):
"""Remove the symlink if it exists."""
progress_bar.set_description("Removing symlink")
script_path = '/usr/local/bin/remindbg'
if os.path.exists(script_path):
os.remove(script_path)
progress_bar.update(1)
print(f"Script {script_path} has been removed.")
else:
progress_bar.update(1)
print(f"No script found at {script_path}.")
def main():
venv_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'venv'))
total_steps = 2 # Removing virtual environment (1 step), removing symlink (1 step)
with tqdm(total=total_steps, desc="Starting uninstallation") as progress_bar:
remove_venv(venv_path, progress_bar)
remove_symlink(progress_bar)
if __name__ == "__main__":
main()