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

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

Issue 29756624: Noissue - Adapt best practices for trailing commas (sitescripts) (Closed)
Patch Set: Re-run script on Python 2, added flake8-commas extension Created April 19, 2018, 2:35 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 18 matching lines...) Expand all
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 'gecko-webext': '.xpi', 34 'gecko-webext': '.xpi',
35 'chrome': '.crx', 35 'chrome': '.crx',
36 'safari': '.safariextz', 36 'safari': '.safariextz',
37 'ie': '.exe', 37 'ie': '.exe',
38 'android': '.apk', 38 'android': '.apk',
39 'edge': '.appx' 39 'edge': '.appx',
40 } 40 }
41 41
42 42
43 def compareVersionParts(part1, part2): 43 def compareVersionParts(part1, part2):
44 def convertInt(value, default): 44 def convertInt(value, default):
45 try: 45 try:
46 return int(value) 46 return int(value)
47 except ValueError: 47 except ValueError:
48 return default 48 return default
49 49
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 if not extensions: 372 if not extensions:
373 return 373 return
374 374
375 updates = {} 375 updates = {}
376 for extension in extensions: 376 for extension in extensions:
377 basename = extension['basename'] 377 basename = extension['basename']
378 updateURL = extension['updateURL'] 378 updateURL = extension['updateURL']
379 version = extension['version'] 379 version = extension['version']
380 updates['%s/%s' % (basename, 'msie64')] = { 380 updates['%s/%s' % (basename, 'msie64')] = {
381 'url': updateURL.replace('.exe', '-x64.msi'), 381 'url': updateURL.replace('.exe', '-x64.msi'),
382 'version': version 382 'version': version,
383 } 383 }
384 updates['%s/%s' % (basename, 'msie32')] = { 384 updates['%s/%s' % (basename, 'msie32')] = {
385 'url': updateURL.replace('.exe', '-x86.msi'), 385 'url': updateURL.replace('.exe', '-x86.msi'),
386 'version': version 386 'version': version,
387 } 387 }
388 writeLibabpUpdateManifest(path, updates) 388 writeLibabpUpdateManifest(path, updates)
389 389
390 390
391 def writeAndroidUpdateManifest(path, extensions): 391 def writeAndroidUpdateManifest(path, extensions):
392 """ 392 """
393 Writes update.json for Android 393 Writes update.json for Android
394 """ 394 """
395 395
396 if not extensions: 396 if not extensions:
397 return 397 return
398 398
399 updates = {} 399 updates = {}
400 for extension in extensions: 400 for extension in extensions:
401 updates[extension['basename']] = { 401 updates[extension['basename']] = {
402 'url': extension['updateURL'], 402 'url': extension['updateURL'],
403 'version': extension['version'] 403 'version': extension['version'],
404 } 404 }
405 writeLibabpUpdateManifest(path, updates) 405 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