implement download fallback for traditional make build

This commit is contained in:
Axel Kohlmeyer
2023-02-01 06:47:25 -05:00
parent 5d16bea899
commit 89b37c51df
9 changed files with 105 additions and 84 deletions

View File

@ -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)):