chiark / gitweb /
Skip widget latest apps generator when data doesn't exist yet
authorCiaran Gultnieks <ciaran@ciarang.com>
Mon, 25 Jun 2012 08:21:10 +0000 (09:21 +0100)
committerCiaran Gultnieks <ciaran@ciarang.com>
Mon, 25 Jun 2012 08:21:10 +0000 (09:21 +0100)
fdroidserver/update.py

index 4647ed09ee5d956da894eab19a9320bc05756cf7..7049c86f6308e40a281ed39636c5fc78f4ef898d 100644 (file)
@@ -486,19 +486,20 @@ def main():
     knownapks.writeifchanged()
 
     # Generate latest apps data for widget
-    data = ''
-    for line in file(os.path.join('stats', 'latestapps.txt')):
-        appid = line.rstrip()
-        data += appid + "\t"
-        for app in apps:
-            if app['id'] == appid:
-                data += app['Name'] + "\t"
-                data += app['icon'] + "\t"
-                data += app['License'] + "\n"
-                break
-    f = open('repo/latestapps.dat', 'w')
-    f.write(data)
-    f.close()
+    if os.path.exists(os.path.join('stats', 'latestapps.txt')):
+        data = ''
+        for line in file(os.path.join('stats', 'latestapps.txt')):
+            appid = line.rstrip()
+            data += appid + "\t"
+            for app in apps:
+                if app['id'] == appid:
+                    data += app['Name'] + "\t"
+                    data += app['icon'] + "\t"
+                    data += app['License'] + "\n"
+                    break
+        f = open('repo/latestapps.dat', 'w')
+        f.write(data)
+        f.close()