Allow archive policy override for indivudual apps

This commit is contained in:
Ciaran Gultnieks 2013-10-14 16:16:34 +01:00
parent ded019291e
commit 25ae0e8d79
3 changed files with 34 additions and 1 deletions

View file

@ -485,6 +485,7 @@ def parse_metadata(metafile, **kw):
thisinfo['Litecoin'] = None
thisinfo['Disabled'] = None
thisinfo['AntiFeatures'] = None
thisinfo['Archive Policy'] = None
thisinfo['Update Check Mode'] = 'None'
thisinfo['Auto Update Mode'] = 'None'
thisinfo['Current Version'] = ''
@ -578,6 +579,17 @@ def parse_metadata(metafile, **kw):
if len(thisinfo['Description']) == 0:
thisinfo['Description'].append('No description available')
# Validate archive policy...
if thisinfo['Archive Policy']:
if not thisinfo['Archive Policy'].endswith(' versions'):
raise MetaDataException("Invalid archive policy")
try:
versions = int(thisinfo['Archive Policy'][:-9])
if versions < 1 or versions > 20:
raise MetaDataException("Silly number of days for archive policy")
except:
raise MetaDataException("Incomprehensible number of days for archive policy")
# Ensure all AntiFeatures are recognised...
if thisinfo['AntiFeatures']:
parts = thisinfo['AntiFeatures'].split(",")
@ -659,6 +671,8 @@ def write_metadata(dest, app):
mf.write('\n')
if len(app['builds']) > 0:
mf.write('\n')
if app['Archive Policy']:
writefield('Archive Policy')
writefield('Auto Update Mode')
writefield('Update Check Mode')
if 'Update Check Data' in app: