commit:     963afe1163125b8cbed08c0e8edea9a05a37510e
Author:     Göktürk Yüksek <gokturk <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 12 03:17:51 2016 +0000
Commit:     Göktürk Yüksek <gokturk <AT> gentoo <DOT> org>
CommitDate: Mon Dec 12 03:17:51 2016 +0000
URL:        https://gitweb.gentoo.org/proj/gentoostats.git/commit/?id=963afe11

client/gentoostats/environment.py: fix getLastSync()

The portage.grabfile() returns an empty list when 'timestamp.chk' does
not exist, instead of None. This is normal for non-rsync syncs. Add a
check for the empty list.

 client/gentoostats/environment.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/client/gentoostats/environment.py 
b/client/gentoostats/environment.py
index 79313e1..913265a 100644
--- a/client/gentoostats/environment.py
+++ b/client/gentoostats/environment.py
@@ -37,7 +37,7 @@ class Environment(object):
             lastsync = portage.grabfile(os.path.join(self.portdir, 'metadata', 
'timestamp.chk'))
         except portage.exception.PortageException:
             pass
-        if lastsync is None:
+        if not lastsync or lastsync is None:
             return 'Unknown'
         return lastsync[0]
 

Reply via email to