Skip to content

Commit

Permalink
backup download server
Browse files Browse the repository at this point in the history
  • Loading branch information
WolfgangWaltenberger committed Sep 30, 2021
1 parent b88dca0 commit a6a714e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions smodels/lib/pythia8/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def rmTarball():
os.unlink ( tarball )

def fetch():
""" fetch tarball from pythia.org """
""" fetch tarball from pythia.org or smodels.github.io """
ver = getVersion()
tarball=f"pythia{ver}.tgz"
if os.path.exists ( tarball ):
Expand All @@ -43,7 +43,14 @@ def fetch():
if r.status_code != 200:
print ( f"[installer.py] could not fetch tarball: {r.reason}." )
rmTarball()
sys.exit(-1)
url=f"http://smodels.github.io/downloads/tarballs/"
print ( f"[installer.py] trying to fetch {tarball} from {url}" )
path = os.path.join ( url, tarball )
r = requests.get ( path, stream=True )
if r.status_code != 200:
print ( f"[installer.py] could not fetch tarball: {r.reason}." )
rmTarball()
sys.exit(-1)
with open ( tarball, "wb" ) as f:
shutil.copyfileobj( r.raw, f )
f.close()
Expand Down

0 comments on commit a6a714e

Please sign in to comment.