mbedtls: fix pytest for newer versions

Fix the expectations in pytest for newer versions of mbedtls

Closes #13132
This commit is contained in:
Stefan Eissing 2024-03-15 10:10:13 +01:00 committed by Daniel Stenberg
parent 79cdae4fc7
commit 3d0fd382a2
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 24 additions and 13 deletions

View file

@ -185,15 +185,15 @@ class EnvConfig:
log.error(f'{self.apxs} failed to run: {e}')
return self._httpd_version
def _versiontuple(self, v):
def versiontuple(self, v):
v = re.sub(r'(\d+\.\d+(\.\d+)?)(-\S+)?', r'\1', v)
return tuple(map(int, v.split('.')))
def httpd_is_at_least(self, minv):
if self.httpd_version is None:
return False
hv = self._versiontuple(self.httpd_version)
return hv >= self._versiontuple(minv)
hv = self.versiontuple(self.httpd_version)
return hv >= self.versiontuple(minv)
def is_complete(self) -> bool:
return os.path.isfile(self.httpd) and \
@ -275,6 +275,14 @@ class Env:
return lversion[len(prefix):]
return 'unknown'
@staticmethod
def curl_lib_version_at_least(libname: str, min_version) -> str:
lversion = Env.curl_lib_version(libname)
if lversion != 'unknown':
return Env.CONFIG.versiontuple(min_version) <= \
Env.CONFIG.versiontuple(lversion)
return False
@staticmethod
def curl_os() -> str:
return Env.CONFIG.curl_props['os']