Merge branch 'develop' into fix-mdi-qmmm

This commit is contained in:
Steve Plimpton
2023-02-02 13:10:55 -07:00
787 changed files with 21433 additions and 96776 deletions

View File

@ -9,7 +9,7 @@ import sys,os,subprocess
import glob
sys.path.append('..')
from install_helpers import checkmd5sum
from install_helpers import fullpath, geturl, checkmd5sum, getfallback
# help message
@ -51,49 +51,6 @@ def error(str=None):
# expand to full path name
# process leading '~' or relative path
def fullpath(path):
return os.path.abspath(os.path.expanduser(path))
def which(program):
def is_exe(fpath):
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
fpath, fname = os.path.split(program)
if fpath:
if is_exe(program):
return program
else:
for path in os.environ["PATH"].split(os.pathsep):
path = path.strip('"')
exe_file = os.path.join(path, program)
if is_exe(exe_file):
return exe_file
return None
def geturl(url,fname):
success = False
if which('curl') != None:
cmd = 'curl -L -o "%s" %s' % (fname,url)
try:
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
success = True
except subprocess.CalledProcessError as e:
print("Calling curl failed with: %s" % e.output.decode('UTF-8'))
if not success and which('wget') != None:
cmd = 'wget -O "%s" %s' % (fname,url)
try:
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
success = True
except subprocess.CalledProcessError as e:
print("Calling wget failed with: %s" % e.output.decode('UTF-8'))
if not success:
error("Failed to download source code with 'curl' or 'wget'")
return
# parse args
args = sys.argv[1:]
@ -123,17 +80,24 @@ lib = os.path.basename(cwd)
# download and unpack MDI_Library tarball
homepath = "."
homepath = fullpath('.')
homedir = "%s/MDI_Library" % homepath
print("Downloading MDI_Library ...")
mditar = "%s/v%s.tar.gz" % (homepath,version)
geturl(url, mditar)
mditar = "%s/v%s.tar.gz" % (homepath, version)
fallback = getfallback('mdi', url)
try:
geturl(url, mditar)
except:
geturl(fallback, mditar)
# verify downloaded archive integrity via md5 checksum, if known.
if version in checksums:
if not checkmd5sum(checksums[version], mditar):
sys.exit("Checksum for MDI library does not match")
print("Checksum did not match. Trying fallback URL", fallback)
geturl(fallback, mditar)
if not checkmd5sum(checksums[version], mditar):
sys.exit("Checksum for MDI library does not match")
print("Unpacking MDI_Library tarball ...")
if os.path.exists("%s/v%s" % (homepath,version)):
@ -199,7 +163,6 @@ makefile_lammps = open(str(dir_path) + "/Makefile.lammps", "a")
makefile_lammps.write(str(rpath_option) + "\n")
makefile_lammps.close()
shared_files = glob.glob( os.path.join( homepath, "liblink", "lib%s.a" % lib) )
if len(shared_files) > 0:
print("Build was successful")