From e7bbf68272f8adc4f2472b86cd14c52fd6b83aaa Mon Sep 17 00:00:00 2001 From: Ciaran Gultnieks Date: Sun, 2 Jan 2011 15:15:55 +0000 Subject: [PATCH] Guarded against an icon specified in the manifest that doesn't actually exist --- update.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/update.py b/update.py index 5ce23118..70dbbc84 100644 --- 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: