Fix regex used in find_versions_of_archive.

Fixes github issue #2, as well as spack create for mvapich.
This commit is contained in:
Todd Gamblin 2014-02-07 10:36:58 -08:00
parent 3df638dd41
commit f09c58549a
2 changed files with 8 additions and 3 deletions

View file

@ -779,15 +779,15 @@ def find_versions_of_archive(archive_url, **kwargs):
if not list_url: if not list_url:
list_url = os.path.dirname(archive_url) list_url = os.path.dirname(archive_url)
if not wildcard: if not wildcard:
wildcard = url.parse_version(archive_url).wildcard() wildcard = url.wildcard_version(archive_url)
versions = VersionList() 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) page_map = get_pages(list_url, depth=list_depth)
for site, page in page_map.iteritems(): for site, page in page_map.iteritems():
strings = re.findall(url_regex, page) strings = set(re.findall(url_regex, page))
for s in strings: for s in strings:
match = re.search(wildcard, s) match = re.search(wildcard, s)

View file

@ -267,3 +267,8 @@ def test_synergy_version(self):
self.assert_detected( self.assert_detected(
'synergy', '1.3.6p2', 'synergy', '1.3.6p2',
'http://synergy.googlecode.com/files/synergy-1.3.6p2-MacOSX-Universal.zip') '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')