wraptool: Fix version comparison

pull/9196/head
Xavier Claessens 3 years ago committed by Xavier Claessens
parent 88a1bed81b
commit 38db4602d8
  1. 8
      mesonbuild/wrap/wraptool.py

@ -98,24 +98,24 @@ def install(options: 'argparse.Namespace') -> None:
f.write(url.read())
print(f'Installed {name} version {version} revision {revision}')
def parse_patch_url(patch_url: str) -> T.Tuple[str, int]:
def parse_patch_url(patch_url: str) -> T.Tuple[str, str]:
u = urlparse(patch_url)
if u.netloc != 'wrapdb.mesonbuild.com':
raise WrapException(f'URL {patch_url} does not seems to be a wrapdb patch')
arr = u.path.strip('/').split('/')
if arr[0] == 'v1':
# e.g. https://wrapdb.mesonbuild.com/v1/projects/zlib/1.2.11/5/get_zip
return arr[-3], int(arr[-2])
return arr[-3], arr[-2]
elif arr[0] == 'v2':
# e.g. https://wrapdb.mesonbuild.com/v2/zlib_1.2.11-5/get_patch
tag = arr[-2]
name, version = tag.rsplit('_', 1)
version, revision = version.rsplit('-', 1)
return version, int(revision)
return version, revision
else:
raise WrapException(f'Invalid wrapdb URL {patch_url}')
def get_current_version(wrapfile: str) -> T.Tuple[str, int, str, str, str]:
def get_current_version(wrapfile: str) -> T.Tuple[str, str, str, str, str]:
cp = configparser.ConfigParser(interpolation=None)
cp.read(wrapfile)
wrap_data = cp['wrap-file']

Loading…
Cancel
Save