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

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

Issue 29355414: Issue 1483 - Add exception handling so if one repo has errors others are not affected (Closed)
Patch Set: Created Sept. 30, 2016, 10:44 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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-2016 Eyeo GmbH 2 # Copyright (C) 2006-2016 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
11 # GNU General Public License for more details. 11 # GNU General Public License for more details.
12 # 12 #
13 # You should have received a copy of the GNU General Public License 13 # You should have received a copy of the GNU General Public License
14 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 14 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
15 15
16 import codecs 16 import codecs
17 import os 17 import os
18 import json 18 import json
19 import re 19 import re
20 import subprocess 20 import subprocess
21 import traceback
21 import time 22 import time
22 import urlparse 23 import urlparse
23 import urllib 24 import urllib
24 import xml.dom.minidom as dom 25 import xml.dom.minidom as dom
25 from ConfigParser import SafeConfigParser, NoOptionError 26 from ConfigParser import SafeConfigParser, NoOptionError
26 from StringIO import StringIO 27 from StringIO import StringIO
27 from sitescripts.utils import get_config 28 from sitescripts.utils import get_config
28 29
29 PACKAGE_SUFFIXES = { 30 PACKAGE_SUFFIXES = {
30 'gecko': '.xpi', 31 'gecko': '.xpi',
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 qrcode.make(text, box_size=5).save(data, 'png') 306 qrcode.make(text, box_size=5).save(data, 'png')
306 return 'data:image/png;base64,' + base64.b64encode(data.getvalue()) 307 return 'data:image/png;base64,' + base64.b64encode(data.getvalue())
307 308
308 309
309 def getDownloadLinks(result): 310 def getDownloadLinks(result):
310 """ 311 """
311 gets the download links for all extensions and puts them into the config 312 gets the download links for all extensions and puts them into the config
312 object 313 object
313 """ 314 """
314 for repo in Configuration.getRepositoryConfigurations(): 315 for repo in Configuration.getRepositoryConfigurations():
315 (downloadURL, version) = _getDownloadLink(repo) 316 try:
316 if downloadURL == None: 317 (downloadURL, version) = _getDownloadLink(repo)
318 except:
319 traceback.print_exc()
317 continue 320 continue
318 if not result.has_section(repo.repositoryName): 321 if not result.has_section(repo.repositoryName):
319 result.add_section(repo.repositoryName) 322 result.add_section(repo.repositoryName)
320 result.set(repo.repositoryName, 'downloadURL', downloadURL) 323 result.set(repo.repositoryName, 'downloadURL', downloadURL)
321 result.set(repo.repositoryName, 'version', version) 324 result.set(repo.repositoryName, 'version', version)
322 325
323 qrcode = _getQRCode(downloadURL) 326 qrcode = _getQRCode(downloadURL)
324 if qrcode != None: 327 if qrcode is not None:
325 result.set(repo.repositoryName, 'qrcode', qrcode) 328 result.set(repo.repositoryName, 'qrcode', qrcode)
326 329
327 330
328 def writeLibabpUpdateManifest(path, updates): 331 def writeLibabpUpdateManifest(path, updates):
329 """ 332 """
330 Writes update.json file for libadblockplus 333 Writes update.json file for libadblockplus
331 """ 334 """
332 335
333 baseDir = os.path.dirname(path) 336 baseDir = os.path.dirname(path)
334 if not os.path.exists(baseDir): 337 if not os.path.exists(baseDir):
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 if not extensions: 374 if not extensions:
372 return 375 return
373 376
374 updates = {} 377 updates = {}
375 for extension in extensions: 378 for extension in extensions:
376 updates[extension['basename']] = { 379 updates[extension['basename']] = {
377 'url': extension['updateURL'], 380 'url': extension['updateURL'],
378 'version': extension['version'] 381 'version': extension['version']
379 } 382 }
380 writeLibabpUpdateManifest(path, updates) 383 writeLibabpUpdateManifest(path, updates)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld