-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.py
More file actions
29 lines (26 loc) · 765 Bytes
/
setup.py
File metadata and controls
29 lines (26 loc) · 765 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
import os
import sys
program_path = 'src/scienWebbing'
link_path = '/usr/sbin/scienWebbing'
if 'install' in sys.argv:
python_path = sys.executable
pgm = open(program_path, 'w')
pgm.writelines('#!'+python_path+'\n')
pre_pgm = open(program_path+'.py', 'r')
pgm_content = pre_pgm.read()
pgm.write(pgm_content)
pgm.close()
pre_pgm.close()
try:
os.chmod(program_path, 0510)
os.symlink(os.path.join(os.getcwd(), program_path), link_path)
except:
print('Install failed. Please verify run with enough privileges')
else:
print('Install succeed!')
elif 'uninstall' in sys.argv:
try:
os.remove(link_path)
os.remove(program_path)
finally:
print('Uninstall succeed!')