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
# 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
@ -30,14 +33,15 @@ make lib-smd args="-g -l" # download/build in default lib/smd/eigen-eigen-*
# 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"
# print error message or help
def error(str=None):
if not str: print help
else: print "ERROR",str
if not str: print(help)
else: print("ERROR",str)
sys.exit()
# 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
if grabflag:
print "Downloading Eigen ..."
cmd = "curl -L %s > %s/%s" % (url,homepath,tarball)
print cmd
print commands.getoutput(cmd)
print("Downloading Eigen ...")
geturl(url,"%s/%s" % (homepath,tarball))
print "Unpacking Eigen tarball ..."
print("Unpacking Eigen tarball ...")
edir = glob.glob("%s/eigen-eigen-*" % homepath)
for one in edir:
if os.path.isdir(one): commands.getoutput("rm -rf %s" % one)
cmd = "cd %s; tar zxvf %s" % (homepath,tarball)
commands.getoutput(cmd)
if os.path.isdir(one):
subprocess.check_output("rm -rf %s" % one,shell=True)
cmd = 'cd "%s"; tar -xzvf %s' % (homepath,tarball)
subprocess.check_output(cmd,shell=True)
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)
os.rename(edir[0],"%s/%s" % (homepath,homedir))
# create link in lib/smd to Eigen src dir
if linkflag:
print "Creating link to Eigen files"
print("Creating link to Eigen files")
if os.path.isfile("includelink") or os.path.islink("includelink"):
os.remove("includelink")
if homedir == "ee":
@ -107,4 +111,4 @@ if linkflag:
linkdir = edir[0]
else: linkdir = "%s/%s" % (homepath,homedir)
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 ...")
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)
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)
if os.path.basename(homedir) != version:
if os.path.exists(homedir):
cmd = ['rm -rf "%s"' % homedir]
cmd = 'rm -rf "%s"' % homedir
subprocess.check_output(cmd,shell=True)
os.rename("%s/%s" % (homepath,version),homedir)
@ -112,7 +112,7 @@ if grabflag:
if buildflag:
print("Building Voro++ ...")
cmd = ['cd "%s"; make' % homedir]
cmd = 'cd "%s"; make' % homedir
txt = subprocess.check_output(cmd,shell=True)
print(txt)