-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathsetup.py
More file actions
37 lines (28 loc) · 1.12 KB
/
setup.py
File metadata and controls
37 lines (28 loc) · 1.12 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
from site import getsitepackages
from sys import executable
from os.path import normpath, dirname, isdir, join
from os import system
from shutil import copytree, rmtree
system('')
module_dirs = getsitepackages()
python_path = dirname(executable)
module_dir = next(dir for dir in module_dirs if python_path in dir and 'site-packages' in dir)
ansi_esc = u'\u001b'
rgb = lambda r, g, b: f'{ansi_esc}[38;2;%s;%s;%sm' % (r, g, b)
reset = f'{ansi_esc}[0m'
red = rgb(255, 75, 75)
cryptMyReplPath = join(module_dir, 'CryptMyRepl')
try:
copytree('./CryptMyRepl', cryptMyReplPath)
except PermissionError:
print(f'{red}cannot create the folder in Python module dir. Try to launch this file in administrator{reset}')
raise SystemExit(1)
except FileExistsError:
try:
rmtree(cryptMyReplPath)
except PermissionError:
print(f'{red}cannot create the folder in Python module dir. Try to launch this file in administrator{reset}')
raise SystemExit(1)
copytree('./CryptMyRepl', cryptMyReplPath)
if isdir(cryptMyReplPath):
print(f'Success! Stored in {cryptMyReplPath}')