Some robustness against malformed timestamps

This commit is contained in:
Alexander van Gessel 2012-09-25 14:13:07 +01:00
parent a2f64398e7
commit dd0d23e72e

View file

@ -70,10 +70,13 @@ if __name__ == "__main__":
if os.path.exists(os.path.join(addon_obj.get_dir(), ADDONVER_FILE)):
with open(os.path.join(addon_obj.get_dir(), ADDONVER_FILE), "r") as stamp_file:
str_timestamp = stamp_file.read()
local_timestamp = int(str_timestamp)
if local_timestamp == server_timestamp:
logging.info("Addon '%s' is up-to-date.", addon_name)
return False
try:
local_timestamp = int(str_timestamp)
if local_timestamp == server_timestamp:
logging.info("Addon '%s' is up-to-date.", addon_name)
return False
except:
pass
# Download the addon.
extract(addon_server, addon_name, temp_dir)