chiark / gitweb /
Guarded against an icon specified in the manifest that doesn't actually exist
authorCiaran Gultnieks <ciaran@ciarang.com>
Sun, 2 Jan 2011 15:15:55 +0000 (15:15 +0000)
committerCiaran Gultnieks <ciaran@ciarang.com>
Sun, 2 Jan 2011 15:15:55 +0000 (15:15 +0000)
update.py

index 5ce231186348d2627695da4303ba311d411630b6..70dbbc84c88c2619c0971116593619ff0823c309 100644 (file)
--- a/update.py
+++ b/update.py
@@ -54,6 +54,8 @@ if os.path.exists(icon_dir):
     shutil.rmtree(icon_dir)
 os.mkdir(icon_dir)
 
+warnings = 0
+
 #Make sure we have the repository description...
 if (repo_url is None or repo_name is None or
         repo_icon is None or repo_description is None):
@@ -133,9 +135,13 @@ for apkfile in glob.glob(os.path.join('repo','*.apk')):
     thisinfo['icon'] = (thisinfo['id'] + '.' +
         thisinfo['versioncode'] + '.png')
     iconfilename = os.path.join(icon_dir, thisinfo['icon'])
-    iconfile = open(iconfilename, 'wb')
-    iconfile.write(apk.read(thisinfo['iconsrc']))
-    iconfile.close()
+    try:
+        iconfile = open(iconfilename, 'wb')
+        iconfile.write(apk.read(thisinfo['iconsrc']))
+        iconfile.close()
+    except:
+        print "WARNING: Error retrieving icon file"
+        warnings += 1
     apk.close()
 
     apks.append(thisinfo)
@@ -211,7 +217,6 @@ root.appendChild(repoel)
 
 apps_inrepo = 0
 apps_disabled = 0
-warnings = 0
 
 for app in apps: