forked from lijiext/lammps
a few more Install.py script changes. untested.
This commit is contained in:
parent
f8a8704ef4
commit
683f8854c2
|
@ -4,7 +4,7 @@
|
|||
# used to automate the steps described in the README file in this dir
|
||||
|
||||
from __future__ import print_function
|
||||
import sys,os,re,subprocess,shutil
|
||||
import sys,os,re,subprocess,shutil,tarfile
|
||||
sys.path.append('..')
|
||||
from install_helpers import get_cpus,fullpath,get_cpus,geturl
|
||||
|
||||
|
@ -70,7 +70,7 @@ tarfile = "MS-CG-%s.tar.gz" % mscgver
|
|||
tardir = "MSCG-release-%s" % mscgver
|
||||
|
||||
homepath = fullpath('.')
|
||||
homedir = "%s/%s" % (homepath,tardir)
|
||||
homedir = os.path.join(homepath,tardir)
|
||||
|
||||
if pathflag:
|
||||
if not os.path.isdir(mscgpath):
|
||||
|
@ -81,7 +81,7 @@ if pathflag:
|
|||
|
||||
if buildflag:
|
||||
print("Downloading MS-CG ...")
|
||||
geturl(url,"%s/%s" % (homepath,tarfile))
|
||||
geturl(url,os.path.join(homepath,tarfile))
|
||||
|
||||
print("Unpacking MS-CG tarfile ...")
|
||||
if os.path.exists("%s/%s" % (homepath,tardir)):
|
||||
|
@ -116,10 +116,9 @@ if buildflag:
|
|||
if not os.path.exists("Makefile.lammps"):
|
||||
print("Creating Makefile.lammps")
|
||||
if os.path.exists("Makefile.lammps.%s" % msuffix):
|
||||
cmd = 'cp Makefile.lammps.%s Makefile.lammps' % msuffix
|
||||
shutil.copyfile('Makefile.lammps.%s' % msuffix,'Makefile.lammps')
|
||||
else:
|
||||
cmd = 'cp Makefile.lammps.default Makefile.lammps'
|
||||
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
|
||||
shutil.copyfile('Makefile.lammps.default','Makefile.lammps')
|
||||
else: print("Makefile.lammps exists. Please check its settings")
|
||||
|
||||
# create 2 links in lib/mscg to MS-CG src dir
|
||||
|
@ -129,7 +128,5 @@ 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")
|
||||
cmd = 'ln -s "%s/src" includelink' % homedir
|
||||
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
|
||||
cmd = 'ln -s "%s/src" liblink' % homedir
|
||||
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
|
||||
os.symlink(os.path.join(homedir,'src'),'includelink')
|
||||
os.symlink(os.path.join(homedir,'src'),'liblink')
|
||||
|
|
|
@ -93,7 +93,7 @@ if buildflag:
|
|||
shutil.rmtree(homedir)
|
||||
cmd = 'cd "%s"; tar -xzvf %s' % (homepath,filename)
|
||||
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
|
||||
os.remove("%s/%s" % (homepath,filename))
|
||||
os.remove(os.path.join(homepath,filename))
|
||||
|
||||
# build plumed
|
||||
print("Building plumed ...")
|
||||
|
@ -113,12 +113,20 @@ 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")
|
||||
cmd = 'ln -s "%s/include" includelink' % homedir
|
||||
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
|
||||
cmd = 'ln -s "%s/lib" liblink' % homedir
|
||||
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
|
||||
os.symlink(os.path.join(homedir,'include'),'includelink')
|
||||
libpath=os.path.join(homedir,'lib64')
|
||||
if no os.path.exists(libpath): libpath=os.path.join(homedir,'lib')
|
||||
os.symlink(libpath,'liblink')
|
||||
if os.path.isfile("Makefile.lammps.%s" % mode):
|
||||
print("Creating Makefile.lammps")
|
||||
cmd = 'echo PLUMED_LIBDIR="%s/lib" > Makefile.lammps; cat liblink/plumed/src/lib/Plumed.inc.%s Makefile.lammps.%s >> Makefile.lammps' % (homedir,mode,mode)
|
||||
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
|
||||
plumedinc = os.path.join('liblink','plumed','src','lib','Plumed.inc.' + mode)
|
||||
lines1 = open(plumedinc,'r').readlines()
|
||||
lines2 = open("Makefile.lammps.%s" % mode,'r').readlines()
|
||||
fp open("Makefile.lammps",'w')
|
||||
fp.write(os.path.join("PLUMED_LIBDIR=",homedir,"lib\n"))
|
||||
for line in lines1:
|
||||
fp.write(line)
|
||||
for line in lines2:
|
||||
fp.write(line)
|
||||
fp.close()
|
||||
|
||||
|
|
Loading…
Reference in New Issue