summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2014-10-30 15:00:02 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2014-10-30 15:00:02 -0700
commitf60fd330cb1a9e5bc420e3a628ae964198083e00 (patch)
treeae21ac59db1223f51f6e6d209d3e30687424f931 /lib
parent132c32076affebe1dd22b833befebe4e57dbb30e (diff)
downloadspack-f60fd330cb1a9e5bc420e3a628ae964198083e00.tar.gz
spack-f60fd330cb1a9e5bc420e3a628ae964198083e00.tar.bz2
spack-f60fd330cb1a9e5bc420e3a628ae964198083e00.tar.xz
spack-f60fd330cb1a9e5bc420e3a628ae964198083e00.zip
Better error messages for extension()
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/util/compression.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/spack/spack/util/compression.py b/lib/spack/spack/util/compression.py
index b4db266fd3..fd17785ad0 100644
--- a/lib/spack/spack/util/compression.py
+++ b/lib/spack/spack/util/compression.py
@@ -61,13 +61,15 @@ def strip_extension(path):
def extension(path):
"""Get the archive extension for a path."""
+ if path is None:
+ raise ValueError("Can't call extension() on None")
# Strip sourceforge suffix.
if re.search(r'((?:sourceforge.net|sf.net)/.*)/download$', path):
path = os.path.dirname(path)
- for type in ALLOWED_ARCHIVE_TYPES:
- suffix = r'\.%s$' % type
+ for t in ALLOWED_ARCHIVE_TYPES:
+ suffix = r'\.%s$' % t
if re.search(suffix, path):
- return type
+ return t
return None