Consider version with the higther number as the latest release
This commit is contained in:
parent
868ee28677
commit
dba77147a5
1 changed files with 15 additions and 2 deletions
|
@ -81,18 +81,31 @@ CURRENT = CURRENT.replace("+", "-")
|
|||
logging.debug("Cleaned current version: %s", CURRENT)
|
||||
|
||||
LATEST = None
|
||||
LATEST_INT = None
|
||||
try:
|
||||
logging.debug("Get releases RSS feed from %s...", options.url)
|
||||
r = requests.get(options.url, timeout=options.timeout)
|
||||
logging.debug("Data retreive:\n%s", r.text)
|
||||
data = xmltodict.parse(r.text)
|
||||
versions = {}
|
||||
for item in data["rss"]["channel"]["item"]:
|
||||
version = re.sub("^v", "", item["title"])
|
||||
if not options.include_rc and "-rc" in version:
|
||||
logging.debug("Ignore release candidate %s", version)
|
||||
continue
|
||||
version_int = int(re.sub(r"[\.-]", "000", version))
|
||||
logging.debug("Found version %s (%s)", version, version_int)
|
||||
if not LATEST_INT or LATEST_INT < version_int:
|
||||
if LATEST:
|
||||
logging.debug(
|
||||
"Version %s considered as newer than %s, override latest version",
|
||||
version,
|
||||
LATEST,
|
||||
)
|
||||
LATEST = version
|
||||
break
|
||||
LATEST_INT = version_int
|
||||
else:
|
||||
logging.debug("Version %s considered as oldest than %s", version, LATEST)
|
||||
except Exception: # pylint: disable=broad-except
|
||||
pass
|
||||
logging.debug("Latest version: %s", LATEST)
|
||||
|
|
Loading…
Reference in a new issue