Add support for .tar files

This commit is contained in:
Adam J. Stewart 2016-03-18 13:03:55 -05:00
parent 179ed7cce6
commit 6acb830263
2 changed files with 4 additions and 5 deletions

View File

@ -142,7 +142,7 @@ def split_url_extension(path):
def downloaded_file_extension(path):
"""This returns the type of archive a URL refers to. This is
sometimes confusing becasue of URLs like:
sometimes confusing because of URLs like:
(1) https://github.com/petdance/ack/tarball/1.93_02

View File

@ -27,13 +27,12 @@
from itertools import product
from spack.util.executable import which
# Supported archvie extensions.
# Supported archive extensions.
PRE_EXTS = ["tar"]
EXTS = ["gz", "bz2", "xz", "Z", "zip", "tgz"]
# Add EXTS last so that .tar.gz is matched *before* tar.gz
ALLOWED_ARCHIVE_TYPES = [".".join(l) for l in product(PRE_EXTS, EXTS)] + EXTS
# Add PRE_EXTS and EXTS last so that .tar.gz is matched *before* .tar or .gz
ALLOWED_ARCHIVE_TYPES = [".".join(l) for l in product(PRE_EXTS, EXTS)] + PRE_EXTS + EXTS
def allowed_archive(path):
return any(path.endswith(t) for t in ALLOWED_ARCHIVE_TYPES)