port USER-SMD folder. make voronoi consistent with it

This commit is contained in:
Axel Kohlmeyer
2017-07-18 17:37:48 -04:00
parent 03cd4c5255
commit 7ccb0d37cd
2 changed files with 23 additions and 19 deletions

View File

@ -3,7 +3,10 @@
# Install.py tool to download, unpack, and point to the Eigen library # Install.py tool to download, unpack, and point to the Eigen library
# used to automate the steps described in the README file in this dir # used to automate the steps described in the README file in this dir
import sys,os,re,glob,commands from __future__ import print_function
import sys,os,re,glob,subprocess
try: from urllib.request import urlretrieve as geturl
except: from urllib import urlretrieve as geturl
# help message # help message
@ -30,14 +33,15 @@ make lib-smd args="-g -l" # download/build in default lib/smd/eigen-eigen-*
# settings # settings
url = "http://bitbucket.org/eigen/eigen/get/3.3.3.tar.gz" version = '3.3.4'
url = "http://bitbucket.org/eigen/eigen/get/%s.tar.gz" % version
tarball = "eigen.tar.gz" tarball = "eigen.tar.gz"
# print error message or help # print error message or help
def error(str=None): def error(str=None):
if not str: print help if not str: print(help)
else: print "ERROR",str else: print("ERROR",str)
sys.exit() sys.exit()
# expand to full path name # expand to full path name
@ -80,26 +84,26 @@ if not os.path.isdir(homepath): error("Eigen path does not exist")
# glob to find name of dir it unpacks to # glob to find name of dir it unpacks to
if grabflag: if grabflag:
print "Downloading Eigen ..." print("Downloading Eigen ...")
cmd = "curl -L %s > %s/%s" % (url,homepath,tarball) geturl(url,"%s/%s" % (homepath,tarball))
print cmd
print commands.getoutput(cmd)
print "Unpacking Eigen tarball ..." print("Unpacking Eigen tarball ...")
edir = glob.glob("%s/eigen-eigen-*" % homepath) edir = glob.glob("%s/eigen-eigen-*" % homepath)
for one in edir: for one in edir:
if os.path.isdir(one): commands.getoutput("rm -rf %s" % one) if os.path.isdir(one):
cmd = "cd %s; tar zxvf %s" % (homepath,tarball) subprocess.check_output("rm -rf %s" % one,shell=True)
commands.getoutput(cmd) cmd = 'cd "%s"; tar -xzvf %s' % (homepath,tarball)
subprocess.check_output(cmd,shell=True)
if homedir != "ee": if homedir != "ee":
if os.path.exists(homedir): commands.getoutput("rm -rf %s" % homedir) if os.path.exists(homedir):
subprocess.check_output("rm -rf %s" % homedir,shell=True)
edir = glob.glob("%s/eigen-eigen-*" % homepath) edir = glob.glob("%s/eigen-eigen-*" % homepath)
os.rename(edir[0],"%s/%s" % (homepath,homedir)) os.rename(edir[0],"%s/%s" % (homepath,homedir))
# create link in lib/smd to Eigen src dir # create link in lib/smd to Eigen src dir
if linkflag: if linkflag:
print "Creating link to Eigen files" print("Creating link to Eigen files")
if os.path.isfile("includelink") or os.path.islink("includelink"): if os.path.isfile("includelink") or os.path.islink("includelink"):
os.remove("includelink") os.remove("includelink")
if homedir == "ee": if homedir == "ee":
@ -107,4 +111,4 @@ if linkflag:
linkdir = edir[0] linkdir = edir[0]
else: linkdir = "%s/%s" % (homepath,homedir) else: linkdir = "%s/%s" % (homepath,homedir)
cmd = "ln -s %s includelink" % linkdir cmd = "ln -s %s includelink" % linkdir
commands.getoutput(cmd) subprocess.check_output(cmd,shell=True)

View File

@ -98,13 +98,13 @@ if grabflag:
print("Unpacking Voro++ tarball ...") print("Unpacking Voro++ tarball ...")
if os.path.exists("%s/%s" % (homepath,version)): if os.path.exists("%s/%s" % (homepath,version)):
cmd = ['rm -rf "%s/%s"' % (homepath,version)] cmd = 'rm -rf "%s/%s"' % (homepath,version)
subprocess.check_output(cmd,shell=True) subprocess.check_output(cmd,shell=True)
cmd = ['cd "%s"; tar -xzvf %s.tar.gz' % (homepath,version)] cmd = 'cd "%s"; tar -xzvf %s.tar.gz' % (homepath,version)
subprocess.check_output(cmd,shell=True) subprocess.check_output(cmd,shell=True)
if os.path.basename(homedir) != version: if os.path.basename(homedir) != version:
if os.path.exists(homedir): if os.path.exists(homedir):
cmd = ['rm -rf "%s"' % homedir] cmd = 'rm -rf "%s"' % homedir
subprocess.check_output(cmd,shell=True) subprocess.check_output(cmd,shell=True)
os.rename("%s/%s" % (homepath,version),homedir) os.rename("%s/%s" % (homepath,version),homedir)
@ -112,7 +112,7 @@ if grabflag:
if buildflag: if buildflag:
print("Building Voro++ ...") print("Building Voro++ ...")
cmd = ['cd "%s"; make' % homedir] cmd = 'cd "%s"; make' % homedir
txt = subprocess.check_output(cmd,shell=True) txt = subprocess.check_output(cmd,shell=True)
print(txt) print(txt)