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

Side by Side Diff: sitescripts/extensions/utils.py

Issue 29756646: Noissue - Adapt best practices for trailing commas (abpssembly) (Closed)
Patch Set: Re-run script on Python 2, added flake8-commas extension Created April 19, 2018, 2:41 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
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 17 matching lines...) Expand all
28 from StringIO import StringIO 28 from StringIO import StringIO
29 from sitescripts.utils import get_config 29 from sitescripts.utils import get_config
30 from xml.parsers.expat import ExpatError 30 from xml.parsers.expat import ExpatError
31 31
32 PACKAGE_SUFFIXES = { 32 PACKAGE_SUFFIXES = {
33 'gecko': '.xpi', 33 'gecko': '.xpi',
34 'chrome': '.crx', 34 'chrome': '.crx',
35 'safari': '.safariextz', 35 'safari': '.safariextz',
36 'ie': '.exe', 36 'ie': '.exe',
37 'android': '.apk', 37 'android': '.apk',
38 'edge': '.appx' 38 'edge': '.appx',
39 } 39 }
40 40
41 41
42 def compareVersionParts(part1, part2): 42 def compareVersionParts(part1, part2):
43 def convertInt(value, default): 43 def convertInt(value, default):
44 try: 44 try:
45 return int(value) 45 return int(value)
46 except ValueError: 46 except ValueError:
47 return default 47 return default
48 48
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 if not extensions: 371 if not extensions:
372 return 372 return
373 373
374 updates = {} 374 updates = {}
375 for extension in extensions: 375 for extension in extensions:
376 basename = extension['basename'] 376 basename = extension['basename']
377 updateURL = extension['updateURL'] 377 updateURL = extension['updateURL']
378 version = extension['version'] 378 version = extension['version']
379 updates['%s/%s' % (basename, 'msie64')] = { 379 updates['%s/%s' % (basename, 'msie64')] = {
380 'url': updateURL.replace('.exe', '-x64.msi'), 380 'url': updateURL.replace('.exe', '-x64.msi'),
381 'version': version 381 'version': version,
382 } 382 }
383 updates['%s/%s' % (basename, 'msie32')] = { 383 updates['%s/%s' % (basename, 'msie32')] = {
384 'url': updateURL.replace('.exe', '-x86.msi'), 384 'url': updateURL.replace('.exe', '-x86.msi'),
385 'version': version 385 'version': version,
386 } 386 }
387 writeLibabpUpdateManifest(path, updates) 387 writeLibabpUpdateManifest(path, updates)
388 388
389 389
390 def writeAndroidUpdateManifest(path, extensions): 390 def writeAndroidUpdateManifest(path, extensions):
391 """ 391 """
392 Writes update.json for Android 392 Writes update.json for Android
393 """ 393 """
394 394
395 if not extensions: 395 if not extensions:
396 return 396 return
397 397
398 updates = {} 398 updates = {}
399 for extension in extensions: 399 for extension in extensions:
400 updates[extension['basename']] = { 400 updates[extension['basename']] = {
401 'url': extension['updateURL'], 401 'url': extension['updateURL'],
402 'version': extension['version'] 402 'version': extension['version'],
403 } 403 }
404 writeLibabpUpdateManifest(path, updates) 404 writeLibabpUpdateManifest(path, updates)
OLDNEW
« no previous file with comments | « sitescripts/extensions/bin/updateUpdateManifests.py ('k') | sitescripts/extensions/web/adblockbrowserUpdates.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld