From c9f28fba552c851ae3ea37bab85a0cc83dff7f7a Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Fri, 11 May 2012 16:55:32 +0100 Subject: [PATCH] Check for staleness --- zeroinstall/apps.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/zeroinstall/apps.py b/zeroinstall/apps.py index 113d1b9..4a678b1 100644 --- a/zeroinstall/apps.py +++ b/zeroinstall/apps.py @@ -9,7 +9,7 @@ Support for managing apps (as created with "0install add"). from zeroinstall import _, SafeException from zeroinstall.support import basedir, portable_rename from zeroinstall.injector import namespaces, selections, qdom -from logging import warn +from logging import warn, info import re, os, time, tempfile # Avoid characters that are likely to cause problems (reject : and ; everywhere @@ -94,7 +94,8 @@ class App: timestamp_path = os.path.join(self.path, 'last-check') try: utime = os.stat(timestamp_path).st_mtime - #print "Staleness", time.time() - utime + staleness = time.time() - utime + info("Staleness of app %s is %d hours", self, staleness / (60 * 60)) need_update = False except Exception as ex: warn("Failed to get time-stamp of %s: %s", timestamp_path, ex) @@ -145,6 +146,9 @@ class App: def get_name(self): return os.path.basename(self.path) + def __str__(self): + return '' + class AppManager: def __init__(self, config): self.config = config -- 2.11.4.GIT