diff options
author | Gregory L. Lee <lee218@llnl.gov> | 2015-02-18 13:14:26 -0800 |
---|---|---|
committer | Gregory L. Lee <lee218@llnl.gov> | 2015-02-18 13:14:26 -0800 |
commit | 59198e29f9760ec0f3c9e612704022d34e55ebf4 (patch) | |
tree | 6f0016ab4b9cf2224a72102810cce56d87fb9fe9 /lib | |
parent | 6e13d0985cf457b3d2b64908c6652ec4fc2349f0 (diff) | |
parent | 3e5aa4b0f5c2b1fba3a81abb465298de93009532 (diff) | |
download | spack-59198e29f9760ec0f3c9e612704022d34e55ebf4.tar.gz spack-59198e29f9760ec0f3c9e612704022d34e55ebf4.tar.bz2 spack-59198e29f9760ec0f3c9e612704022d34e55ebf4.tar.xz spack-59198e29f9760ec0f3c9e612704022d34e55ebf4.zip |
Merge branch 'develop' of ssh://cz-stash.llnl.gov:7999/scale/spack into develop
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/fetch_strategy.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py index a71f3a1531..48313e2b37 100644 --- a/lib/spack/spack/fetch_strategy.py +++ b/lib/spack/spack/fetch_strategy.py @@ -41,6 +41,7 @@ in order to build it. They need to define the following methods: Archive a source directory, e.g. for creating a mirror. """ import os +import sys import re import shutil from functools import wraps @@ -141,13 +142,19 @@ class URLFetchStrategy(FetchStrategy): tty.msg("Trying to fetch from %s" % self.url) + curl_args = ['-O', # save file to disk + '-f', # fail on >400 errors + '-D', '-', # print out HTML headers + '-L', self.url,] + + if sys.stdout.isatty(): + curl_args.append('-#') # status bar when using a tty + else: + curl_args.append('-sS') # just errors when not. + # Run curl but grab the mime type from the http headers - headers = spack.curl('-#', # status bar - '-O', # save file to disk - '-f', # fail on >400 errors - '-D', '-', # print out HTML headers - '-L', self.url, - return_output=True, fail_on_error=False) + headers = spack.curl( + *curl_args, return_output=True, fail_on_error=False) if spack.curl.returncode != 0: # clean up archive on failure. |