From: Ciaran Gultnieks Date: Mon, 25 Jun 2012 08:21:10 +0000 (+0100) Subject: Skip widget latest apps generator when data doesn't exist yet X-Git-Tag: 0.1~807 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=388f997d37d029304aa1d235d863f4ce29f038d1;p=fdroidserver.git Skip widget latest apps generator when data doesn't exist yet --- diff --git a/fdroidserver/update.py b/fdroidserver/update.py index 4647ed09..7049c86f 100644 --- a/fdroidserver/update.py +++ b/fdroidserver/update.py @@ -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()