diff options
author | Adam J. Stewart <ajstewart426@gmail.com> | 2017-06-09 01:53:40 -0500 |
---|---|---|
committer | Massimiliano Culpo <massimiliano.culpo@googlemail.com> | 2017-06-09 08:53:40 +0200 |
commit | 85fd8f0b31b2df7ec610e13092b9e43aeca01d45 (patch) | |
tree | 0a248f8387ace1c36896718024e6e429c7694e20 | |
parent | a6bbbd4458f39d83e3c5399fcac38ff014126641 (diff) | |
download | spack-85fd8f0b31b2df7ec610e13092b9e43aeca01d45.tar.gz spack-85fd8f0b31b2df7ec610e13092b9e43aeca01d45.tar.bz2 spack-85fd8f0b31b2df7ec610e13092b9e43aeca01d45.tar.xz spack-85fd8f0b31b2df7ec610e13092b9e43aeca01d45.zip |
Fix url parse offset for SourceForge downloads (#4458)
-rw-r--r-- | lib/spack/spack/test/url_parse.py | 2 | ||||
-rw-r--r-- | lib/spack/spack/url.py | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/spack/spack/test/url_parse.py b/lib/spack/spack/test/url_parse.py index cf6f262fdf..5489cc8d26 100644 --- a/lib/spack/spack/test/url_parse.py +++ b/lib/spack/spack/test/url_parse.py @@ -160,6 +160,8 @@ def test_url_strip_name_suffixes(url, version, expected): ('sionlib', 30, '1.7.1', 59, 'http://apps.fz-juelich.de/jsc/sionlib/download.php?version=1.7.1'), # Regex in name ('voro++', 40, '0.4.6', 47, 'http://math.lbl.gov/voro++/download/dir/voro++-0.4.6.tar.gz'), + # SourceForge download + ('glew', 55, '2.0.0', 60, 'https://sourceforge.net/projects/glew/files/glew/2.0.0/glew-2.0.0.tgz/download'), ]) def test_url_parse_offset(name, noffset, ver, voffset, path): """Tests that the name, version and offsets are computed correctly. diff --git a/lib/spack/spack/url.py b/lib/spack/spack/url.py index 8f2129b84a..54b3b74f1b 100644 --- a/lib/spack/spack/url.py +++ b/lib/spack/spack/url.py @@ -301,7 +301,8 @@ def split_url_extension(path): prefix, ext, suffix = path, '', '' # Strip off sourceforge download suffix. - match = re.search(r'((?:sourceforge\.net|sf\.net)/.*)(/download)$', path) + # e.g. https://sourceforge.net/projects/glew/files/glew/2.0.0/glew-2.0.0.tgz/download + match = re.search(r'(.*(?:sourceforge\.net|sf\.net)/.*)(/download)$', path) if match: prefix, suffix = match.groups() |