From f09c58549a31b2de17b572862aa66c432e84439c Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Fri, 7 Feb 2014 10:36:58 -0800 Subject: [PATCH] Fix regex used in find_versions_of_archive. Fixes github issue #2, as well as spack create for mvapich. --- lib/spack/spack/package.py | 6 +++--- lib/spack/spack/test/url_parse.py | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index ce4a98d99b..4f79f56ec9 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -779,15 +779,15 @@ def find_versions_of_archive(archive_url, **kwargs): if not list_url: list_url = os.path.dirname(archive_url) if not wildcard: - wildcard = url.parse_version(archive_url).wildcard() + wildcard = url.wildcard_version(archive_url) versions = VersionList() - url_regex = os.path.basename(url.wildcard_version(archive_url)) + url_regex = os.path.basename(wildcard) page_map = get_pages(list_url, depth=list_depth) for site, page in page_map.iteritems(): - strings = re.findall(url_regex, page) + strings = set(re.findall(url_regex, page)) for s in strings: match = re.search(wildcard, s) diff --git a/lib/spack/spack/test/url_parse.py b/lib/spack/spack/test/url_parse.py index f02bb72075..109402608b 100644 --- a/lib/spack/spack/test/url_parse.py +++ b/lib/spack/spack/test/url_parse.py @@ -267,3 +267,8 @@ def test_synergy_version(self): self.assert_detected( 'synergy', '1.3.6p2', 'http://synergy.googlecode.com/files/synergy-1.3.6p2-MacOSX-Universal.zip') + + def test_mvapich2_version(self): + self.assert_detected( + 'mvapich2', '1.9', + 'http://mvapich.cse.ohio-state.edu/download/mvapich2/mv2/mvapich2-1.9.tgz')