forked from codemation/easyjobs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.py
executable file
·29 lines (29 loc) · 1.08 KB
/
install.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
#!/usr/bin/env python
if __name__=='__main__':
import os, sys
#Check for bin path - install in venv/bin/ if active - else /usr/bin/
env = sys.prefix
version = f'python{sys.version_info[0]}.{sys.version_info[1]}'
install_dir = f'{env}/lib/{version}/easyjobs'
if 'install' in sys.argv:
try:
os.makedirs(install_dir)
os.system(f'cp easyjobs/*.py README.md {install_dir}')
print("easyjobs successfully installed - see https://github.com/codemation/easyjobs for usage")
except Exception as e:
error = repr(e)
if 'Permission denied' in error:
print(f'{error} - try sudo ./setup.py install')
else:
print(error)
elif 'remove' in sys.argv:
try:
os.system(f'rm -rf {install_dir}')
except Exception as e:
error = repr(e)
if 'Permission denied' in error:
print(f'{error} - try sudo ./setup.py remove')
else:
print(error)
else:
print("missing flag - install|remove")