mirror of https://github.com/lammps/lammps.git
git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@12902 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
parent
9847711956
commit
99604912b9
|
@ -28,12 +28,11 @@ Type "python install.py" for instructions.
|
|||
% make install
|
||||
|
||||
4. Create two soft links in this dir (lib/voronoi)
|
||||
to where the Voro++ src directory is. E.g if you
|
||||
built Voro++ in this dir:
|
||||
to the Voro++ src directory is. E.g if you built Voro++ in this dir:
|
||||
% ln -s voro++-0.4.6/src includelink
|
||||
% ln -s voro++-0.4.6/src liblink
|
||||
Note that these links could also be set to the include and lib
|
||||
directories created by a Voro++ install, if you prefer, e.g.
|
||||
directories created by a Voro++ install, e.g.
|
||||
% ln -s /usr/local/include includelink
|
||||
% ln -s /usr/local/lib liblink
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# install.py tool to download, unpack, build, and link to the Voro++ library
|
||||
# used to automate the steps described in the README file in this dir
|
||||
|
||||
import sys,os,urllib,commands
|
||||
import sys,os,re,urllib,commands
|
||||
|
||||
help = """
|
||||
Syntax: install.py -d dir -v version -g -b -i installdir -l incdir libdir
|
||||
|
@ -25,6 +25,7 @@ Syntax: install.py -d dir -v version -g -b -i installdir -l incdir libdir
|
|||
-l = create two links to incdir and libdir
|
||||
incdir and libdir are optional (specify neither or both):
|
||||
if specified, includelink and liblink are to those two dirs
|
||||
these are dirs where Voro++ include files and lib file are
|
||||
if not specified and no install, links are to Voro++ src dir
|
||||
if not specified and install performed,
|
||||
links are to include and lib dirs under PREFIX
|
||||
|
@ -64,24 +65,28 @@ while iarg < len(args):
|
|||
buildflag = 1
|
||||
iarg += 1
|
||||
elif args[iarg] == "-i":
|
||||
if iarg+2 > len(args): error()
|
||||
installflag = 1
|
||||
if iarg+1 == len(args) or args[iarg+1][0] == '-':
|
||||
installdir = ""
|
||||
iarg += 1
|
||||
else:
|
||||
if iarg+2 > len(args): error()
|
||||
installdir = args[iarg+1]
|
||||
iarg += 2
|
||||
elif args[iarg] == "-l":
|
||||
if iarg+2 > len(args): error()
|
||||
if iarg+1 == len(args) or args[iarg+1][0] == '-':
|
||||
incdir = libdir = ""
|
||||
linkflag = 1
|
||||
if iarg+1 == len(args) or args[iarg+1][0] == '-' or \
|
||||
iarg+2 == len(args) or args[iarg+2][0] == '-':
|
||||
includedir = libdir = ""
|
||||
iarg += 1
|
||||
else:
|
||||
incdir = args[iarg+1]
|
||||
if iarg+3 > len(args): error()
|
||||
includedir = args[iarg+1]
|
||||
libdir = args[iarg+2]
|
||||
iarg += 3
|
||||
else: error()
|
||||
|
||||
dir = os.path.abspath(dir)
|
||||
url = "http://math.lbl.gov/voro++/download/dir/%s.tar.gz" % version
|
||||
|
||||
# create dir if does not exist
|
||||
|
@ -104,7 +109,7 @@ if grabflag:
|
|||
cmd = "cd %s; tar zxvf %s.tar.gz" % (dir,version)
|
||||
txt = commands.getoutput(cmd)
|
||||
|
||||
# build Voro++
|
||||
# build Voro++ in its dir
|
||||
|
||||
if buildflag:
|
||||
print "Building Voro++ ..."
|
||||
|
@ -113,15 +118,46 @@ if buildflag:
|
|||
print txt
|
||||
|
||||
# install Voro++
|
||||
|
||||
|
||||
|
||||
# if installdir set, overwrite PREFIX var in its config.mk file
|
||||
# if PREFIX var starts with /usr, invoke sudo make install, else make install
|
||||
|
||||
if installflag:
|
||||
print "Installing Voro++ ..."
|
||||
if installdir:
|
||||
txt = open("%s/%s/config.mk" % (dir,version),'r').read()
|
||||
txt = re.sub("PREFIX=.*?\n","PREFIX=%s\n" % installdir,txt)
|
||||
open("%s/%s/config.mk" % (dir,version),'w').write(txt)
|
||||
print "TXT:",txt
|
||||
txt = open("%s/%s/config.mk" % (dir,version),'r').read()
|
||||
var = re.findall("PREFIX=.*?\n",txt)
|
||||
prefix = var[0].split('=')[1].strip()
|
||||
if prefix.startswith("/usr"):
|
||||
cmd = "cd %s/%s; sudo make install" % (dir,version)
|
||||
else:
|
||||
cmd = "cd %s/%s; make install" % (dir,version)
|
||||
txt = commands.getoutput(cmd)
|
||||
print txt
|
||||
|
||||
# create links in this dir to Voro++ include and lib files
|
||||
|
||||
if linkflag:
|
||||
print "Creating links to Voro++ include and lib files"
|
||||
cmd = "ln -s %s/src includelink" % version
|
||||
txt = commands.getoutput(cmd)
|
||||
cmd = "ln -s %s/src liblink" % version
|
||||
txt = commands.getoutput(cmd)
|
||||
if os.path.isfile("includelink") or os.path.islink("includelink"):
|
||||
os.remove("includelink")
|
||||
if os.path.isfile("liblink") or os.path.islink("liblink"):
|
||||
os.remove("liblink")
|
||||
if includedir:
|
||||
cmd = "ln -s %s includelink" % includedir
|
||||
txt = commands.getoutput(cmd)
|
||||
cmd = "ln -s %s liblink" % linkdir
|
||||
txt = commands.getoutput(cmd)
|
||||
elif not installflag:
|
||||
cmd = "ln -s %s/%s/src includelink" % (dir,version)
|
||||
txt = commands.getoutput(cmd)
|
||||
cmd = "ln -s %s/%s/src liblink" % (dir,version)
|
||||
txt = commands.getoutput(cmd)
|
||||
else:
|
||||
cmd = "ln -s %s/include includelink" % prefix
|
||||
txt = commands.getoutput(cmd)
|
||||
cmd = "ln -s %s/lib liblink" % prefix
|
||||
txt = commands.getoutput(cmd)
|
||||
|
|
Loading…
Reference in New Issue