Fix url parse offset for SourceForge downloads (#4458)
This commit is contained in:
parent
a6bbbd4458
commit
85fd8f0b31
@ -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'),
|
('sionlib', 30, '1.7.1', 59, 'http://apps.fz-juelich.de/jsc/sionlib/download.php?version=1.7.1'),
|
||||||
# Regex in name
|
# Regex in name
|
||||||
('voro++', 40, '0.4.6', 47, 'http://math.lbl.gov/voro++/download/dir/voro++-0.4.6.tar.gz'),
|
('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):
|
def test_url_parse_offset(name, noffset, ver, voffset, path):
|
||||||
"""Tests that the name, version and offsets are computed correctly.
|
"""Tests that the name, version and offsets are computed correctly.
|
||||||
|
@ -301,7 +301,8 @@ def split_url_extension(path):
|
|||||||
prefix, ext, suffix = path, '', ''
|
prefix, ext, suffix = path, '', ''
|
||||||
|
|
||||||
# Strip off sourceforge download suffix.
|
# 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:
|
if match:
|
||||||
prefix, suffix = match.groups()
|
prefix, suffix = match.groups()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user