-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathuninstall.py
More file actions
executable file
·32 lines (25 loc) · 920 Bytes
/
uninstall.py
File metadata and controls
executable file
·32 lines (25 loc) · 920 Bytes
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
#! /usr/bin/python3
# -*- coding:Utf-8 -*-
# Uninstall BraceletGenerator >= 1.3.0 (only if installed with setup.py)
import os
import sys
import shutil
local_path = os.path.expanduser("~")
if os.path.exists("/usr/bin/bracelet-generator"):
os.remove("/usr/bin/bracelet-generator")
module_paths = sys.path
for path in module_paths:
mod = os.path.join(path, "BraceletGenerator")
if os.path.exists(mod):
shutil.rmtree(mod)
menu_entry = os.path.join(local_path, ".local", "share", "applications", "bracelet-generator.desktop")
if os.path.exists(menu_entry):
os.remove(menu_entry)
config = os.path.join(local_path, "BraceletGenerator")
if os.path.exists(config):
l = os.listdir(config)
to_delete = [f for f in l if (l[-3:] in ["log", "ini"] or l[-6:] == "config")]
for f in to_delete:
os.remove(os.path.join(config, f))
if not os.listdir(config):
os.rmdir(config)