diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/util/compression.py | 8 |
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 |