update sparkle

This commit is contained in:
lilydjwg 2021-07-01 19:47:47 +08:00
parent f8dd1a4212
commit 46d724b465

View File

@ -13,19 +13,6 @@ async def get_version(name, conf, *, cache, **kwargs):
async def get_version_impl(sparkle):
res = await session.get(sparkle)
root = ElementTree.fromstring(res.body)
item = root.find('./channel/item[1]/enclosure')
version = root.find('./channel/item[1]/{http://www.andymatuschak.org/xml-namespaces/sparkle}version')
version_string = item.get('{http://www.andymatuschak.org/xml-namespaces/sparkle}shortVersionString')
build_number = item.get('{http://www.andymatuschak.org/xml-namespaces/sparkle}version')
if (version_string and version_string.isdigit()) and (build_number and not build_number.isdigit()):
version_string, build_number = build_number, version_string
version = []
if version_string:
version.append(version_string)
if build_number and (build_number not in version):
version.append(build_number)
return '-'.join(version) if version else None
return version.text