emerge-lastsync.py: handle the never-synced case
authorW. Trevor King <wking@tremily.us>
Sat, 8 Dec 2012 23:58:11 +0000 (18:58 -0500)
committerW. Trevor King <wking@tremily.us>
Sat, 8 Dec 2012 23:58:11 +0000 (18:58 -0500)
posts/conky/emerge-lastsync.py

index 398524e7e8098c6bb81b8ab6b88fc2fb39f18c1a..9ef908aed869d1196fb7dc57c08a9ea28f31adda 100755 (executable)
@@ -12,4 +12,7 @@ for line in open('/var/log/emerge.log', 'r'):
     sync_time = int(line[:10])
     syncs.append(sync_time)
 
-print(time.strftime('%a, %b %e', time.localtime(syncs[-1])))
+if syncs:
+    print(time.strftime('%a, %b %e', time.localtime(syncs[-1])))
+else:
+    print('never')