Addon Manager: Fix for Py3.6 w/ no fromisodate
This commit is contained in:
@@ -258,7 +258,13 @@ class CommandAddonManager:
|
||||
if last_cache_update_string == "never":
|
||||
self.update_cache = True
|
||||
elif days_between_updates > 0:
|
||||
last_cache_update = date.fromisoformat(last_cache_update_string)
|
||||
if hasattr(date, "fromisoformat"):
|
||||
last_cache_update = date.fromisoformat(last_cache_update_string)
|
||||
else:
|
||||
# Python 3.6 and earlier don't have date.fromisoformat
|
||||
date_re = re.compile("([0-9]{4})-?(1[0-2]|0[1-9])-?(3[01]|0[1-9]|[12][0-9])")
|
||||
matches = date_re.match (last_cache_update_string)
|
||||
last_cache_update = date(int(matches.group(1)),int(matches.group(2)),int(matches.group(3)))
|
||||
delta_update = timedelta(days=days_between_updates)
|
||||
if date.today() >= last_cache_update + delta_update:
|
||||
self.update_cache = True
|
||||
|
||||
Reference in New Issue
Block a user