-
Notifications
You must be signed in to change notification settings - Fork 2
/
install.py
31 lines (22 loc) · 855 Bytes
/
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/python
import lxml.etree as lxml
import argparse as ap
import os
pythonpaths=["lib","lib/cluster","lib/xtp"]
paths=["xtp","Gaussian","Gromacs","Jobadmin"]
parser=ap.ArgumentParser(description="Adds required paths to PYTHONPATH and PATH in the .bashrc file")
args=parser.parse_args()
path=os.getcwd()
home=os.environ['HOME']
print "Writing entries to {}/.bashrc".format(home)
with open(home+"/.bashrc","r") as f:
lines=f.readlines()
with open(home+"/.bashrc","a") as f:
for entry in paths:
pathcommand="export PATH={}:$PATH\n".format(os.path.join(path,entry))
if pathcommand not in lines:
f.write(pathcommand)
for entry in pythonpaths:
pathcommand="export PYTHONPATH={}:$PYTHONPATH\n".format(os.path.join(path,entry))
if pathcommand not in lines:
f.write(pathcommand)