Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: sitescripts/extensions/bin/createNightlies.py

Issue 29730555: Noissue - don't fail on non-existent lockfile (Closed) Base URL: https://hg.adblockplus.org/abpssembly/file/93c8f5ecd4b1
Left Patch Set: Created March 22, 2018, 8:24 a.m.
Right Patch Set: Created March 22, 2018, 8:29 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 # This file is part of the Adblock Plus web scripts, 1 # This file is part of the Adblock Plus web scripts,
2 # Copyright (C) 2006-present eyeo GmbH 2 # Copyright (C) 2006-present eyeo GmbH
3 # 3 #
4 # Adblock Plus is free software: you can redistribute it and/or modify 4 # Adblock Plus is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License version 3 as 5 # it under the terms of the GNU General Public License version 3 as
6 # published by the Free Software Foundation. 6 # published by the Free Software Foundation.
7 # 7 #
8 # Adblock Plus is distributed in the hope that it will be useful, 8 # Adblock Plus is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 links.append(link) 419 links.append(link)
420 template = get_template(get_config().get('extensions', 'nightlyIndexPage ')) 420 template = get_template(get_config().get('extensions', 'nightlyIndexPage '))
421 template.stream({'config': self.config, 'links': links}).dump(outputPath ) 421 template.stream({'config': self.config, 'links': links}).dump(outputPath )
422 422
423 def read_downloads_lockfile(self): 423 def read_downloads_lockfile(self):
424 path = get_config().get('extensions', 'downloadLockFile') 424 path = get_config().get('extensions', 'downloadLockFile')
425 try: 425 try:
426 with open(path, 'r') as fp: 426 with open(path, 'r') as fp:
427 current = json.load(fp) 427 current = json.load(fp)
428 except IOError: 428 except IOError:
429 logging.debug('No lockfile found. Creating ' + path) 429 logging.debug('No lockfile found at ' + path)
430 current = {} 430 current = {}
431 431
432 return current 432 return current
433 433
434 def write_downloads_lockfile(self, values): 434 def write_downloads_lockfile(self, values):
435 path = get_config().get('extensions', 'downloadLockFile') 435 path = get_config().get('extensions', 'downloadLockFile')
436 with open(path, 'w') as fp: 436 with open(path, 'w') as fp:
437 json.dump(values, fp) 437 json.dump(values, fp)
438 438
439 def add_to_downloads_lockfile(self, platform, values): 439 def add_to_downloads_lockfile(self, platform, values):
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 879
880 file = open(nightlyConfigFile, 'wb') 880 file = open(nightlyConfigFile, 'wb')
881 nightlyConfig.write(file) 881 nightlyConfig.write(file)
882 882
883 883
884 if __name__ == '__main__': 884 if __name__ == '__main__':
885 parser = argparse.ArgumentParser() 885 parser = argparse.ArgumentParser()
886 parser.add_argument('--download', action='store_true', default=False) 886 parser.add_argument('--download', action='store_true', default=False)
887 args = parser.parse_args() 887 args = parser.parse_args()
888 main(args.download) 888 main(args.download)
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld