chromium: Fix the version comparison in print_updates()

I forgot that string comparison isn't enough because e.g.:
>>> "89.0.4389.9" < "89.0.4389.23"
False

distutils.version.LooseVersion is undocumented but it works and is
already available so why not use it:
>>> LooseVersion("89.0.4389.9") < LooseVersion("89.0.4389.23")
True
This commit is contained in:
Michael Weiss 2021-01-28 15:34:34 +01:00
parent ff937db1f6
commit 863982d272
No known key found for this signature in database
GPG Key ID: 5BE487C4D4771D83

View File

@ -13,6 +13,7 @@ import sys
from codecs import iterdecode
from collections import OrderedDict
from datetime import datetime
from distutils.version import LooseVersion
from os.path import abspath, dirname
from urllib.request import urlopen
@ -122,7 +123,7 @@ def print_updates(channels_old, channels_new):
for channel_name in channels_old:
version_old = channels_old[channel_name]["version"]
version_new = channels_new[channel_name]["version"]
if version_old < version_new:
if LooseVersion(version_old) < LooseVersion(version_new):
attr_name = channel_name_to_attr_name(channel_name)
print(f'- {attr_name}: {version_old} -> {version_new}')