Commit aef17caf authored by Kirill Smelkov's avatar Kirill Smelkov

Fix support for HDF5 URL

Because in 'patch1' the fraction of digits is only 1/6 it was failed to
be recognized as version. Rework version detection heuristic to
recpognize 'patch' and similar words as versions and increase ndigit
threshold - since we now do not need to keep it so low as 1/5 due to
e.g. slapospatched012 and similar cases.

Occured in Wendelin.
parent f46be314
...@@ -355,7 +355,10 @@ def _namever(url, failonerr): ...@@ -355,7 +355,10 @@ def _namever(url, failonerr):
for _ in v: for _ in v:
if _.isnumeric(): if _.isnumeric():
v_ndigit += 1 v_ndigit += 1
if v_ndigit < (len(v)-1) / 5: # doesn't look like a version isver = 'patch' in v or \
'slapospatched' in v or \
v_ndigit > (len(v)-1) / 3
if not isver: # doesn't look like a version
break break
name = name[:m.start()] name = name[:m.start()]
ver = v + ver ver = v + ver
......
...@@ -45,6 +45,7 @@ from os.path import dirname, exists ...@@ -45,6 +45,7 @@ from os.path import dirname, exists
('https://github.com/unicode-org/icu/releases/download/release-58-2/icu4c-58_2-src.tgz', 'icu4c', '58_2'), ('https://github.com/unicode-org/icu/releases/download/release-58-2/icu4c-58_2-src.tgz', 'icu4c', '58_2'),
('https://lab.nexedi.com/bk/onlyoffice_core/repository/archive.tar.bz2?ref=8a40eb47bd80a40ecde14c223525b21852d2fc9f', 'onlyoffice_core', '8a40eb47bd80a40ecde14c223525b21852d2fc9f'), ('https://lab.nexedi.com/bk/onlyoffice_core/repository/archive.tar.bz2?ref=8a40eb47bd80a40ecde14c223525b21852d2fc9f', 'onlyoffice_core', '8a40eb47bd80a40ecde14c223525b21852d2fc9f'),
('http://snowball.tartarus.org/dist/libstemmer_c.tgz', 'libstemmer_c', None), ('http://snowball.tartarus.org/dist/libstemmer_c.tgz', 'libstemmer_c', None),
('https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.0-patch1/src/hdf5-1.10.0-patch1.tar.bz2', 'hdf5', '1.10.0-patch1'),
]) ])
def test_namever(url, nameok, verok): def test_namever(url, nameok, verok):
assert nxdbom.namever(url) == (nameok, verok) assert nxdbom.namever(url) == (nameok, verok)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment