implement download fallback for traditional make build
This commit is contained in:
@ -10,7 +10,7 @@ import sys, os, platform, subprocess, shutil
|
||||
from argparse import ArgumentParser
|
||||
|
||||
sys.path.append('..')
|
||||
from install_helpers import get_cpus, fullpath, geturl, checkmd5sum
|
||||
from install_helpers import get_cpus, fullpath, geturl, checkmd5sum, getfallback
|
||||
|
||||
parser = ArgumentParser(prog='Install.py',
|
||||
description="LAMMPS library build wrapper script")
|
||||
@ -76,14 +76,21 @@ if pathflag:
|
||||
|
||||
if buildflag:
|
||||
url = "https://github.com/CompPhysVienna/n2p2/archive/v%s.tar.gz" % (version)
|
||||
filename = "n2p2-%s.tar.gz" %version
|
||||
print("Downloading n2p2 ...")
|
||||
geturl(url, filename)
|
||||
filename = "n2p2-%s.tar.gz" % version
|
||||
fallback = getfallback('n2p2', url)
|
||||
print("Downloading n2p2 from", url)
|
||||
try:
|
||||
geturl(url, filename)
|
||||
except:
|
||||
geturl(fallback, filename)
|
||||
|
||||
# verify downloaded archive integrity via md5 checksum, if known.
|
||||
if version in checksums:
|
||||
if not checkmd5sum(checksums[version], filename):
|
||||
sys.exit("Checksum for n2p2 library does not match")
|
||||
print("Checksum did not match. Trying fallback URL", fallback)
|
||||
geturl(fallback, filename)
|
||||
if not checkmd5sum(checksums[version], filename):
|
||||
sys.exit("Checksum for n2p2 library does not match for fallback, too.")
|
||||
|
||||
print("Unpacking n2p2 source tarball ...")
|
||||
if os.path.exists("%s/n2p2-%s" % (homepath, version)):
|
||||
|
||||
Reference in New Issue
Block a user