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

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

Issue 29370859: Issue 4767 - Improve error reporting in update_update_manifests (Closed)
Patch Set: Fix mistake while uploading the patchset Created Jan. 8, 2017, 7:26 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
« 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 traceback
22 import time 22 import time
23 import urlparse 23 import urlparse
24 import urllib 24 import urllib
25 import xml.dom.minidom as dom 25 import xml.dom.minidom as dom
26 from ConfigParser import SafeConfigParser, NoOptionError 26 from ConfigParser import SafeConfigParser, NoOptionError
27 from StringIO import StringIO 27 from StringIO import StringIO
28 from sitescripts.utils import get_config 28 from sitescripts.utils import get_config
29 from xml.parsers.expat import ExpatError
29 30
30 PACKAGE_SUFFIXES = { 31 PACKAGE_SUFFIXES = {
31 'gecko': '.xpi', 32 'gecko': '.xpi',
32 'gecko-webext': '.xpi', 33 'gecko-webext': '.xpi',
33 'chrome': '.crx', 34 'chrome': '.crx',
34 'safari': '.safariextz', 35 'safari': '.safariextz',
35 'ie': '.exe', 36 'ie': '.exe',
36 'android': '.apk' 37 'android': '.apk'
37 } 38 }
38 39
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 """ 314 """
314 gets the download links for all extensions and puts them into the config 315 gets the download links for all extensions and puts them into the config
315 object 316 object
316 """ 317 """
317 for repo in Configuration.getRepositoryConfigurations(): 318 for repo in Configuration.getRepositoryConfigurations():
318 try: 319 try:
319 (downloadURL, version) = _getDownloadLink(repo) 320 (downloadURL, version) = _getDownloadLink(repo)
320 if downloadURL is None: 321 if downloadURL is None:
321 raise Exception('No download link found for repo: ' + 322 raise Exception('No download link found for repo: ' +
322 repo.repositoryName) 323 repo.repositoryName)
324 except ExpatError:
325 traceback.print_exc()
326 print "Error found while parsing xml from %s link" % repo.repository Name
Jon Sonesen 2017/01/09 07:48:22 Here you should be using the .format() method for
Jon Sonesen 2017/01/09 08:44:10 Oops, I also just noticed that you are using doubl
f.nicolaisen 2017/01/10 08:58:04 This adds some context (i.e. which repo) to the er
327 continue
323 except: 328 except:
324 traceback.print_exc() 329 traceback.print_exc()
325 continue 330 continue
326 if not result.has_section(repo.repositoryName): 331 if not result.has_section(repo.repositoryName):
327 result.add_section(repo.repositoryName) 332 result.add_section(repo.repositoryName)
328 result.set(repo.repositoryName, 'downloadURL', downloadURL) 333 result.set(repo.repositoryName, 'downloadURL', downloadURL)
329 result.set(repo.repositoryName, 'version', version) 334 result.set(repo.repositoryName, 'version', version)
330 335
331 qrcode = _getQRCode(downloadURL) 336 qrcode = _getQRCode(downloadURL)
332 if qrcode is not None: 337 if qrcode is not None:
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 if not extensions: 384 if not extensions:
380 return 385 return
381 386
382 updates = {} 387 updates = {}
383 for extension in extensions: 388 for extension in extensions:
384 updates[extension['basename']] = { 389 updates[extension['basename']] = {
385 'url': extension['updateURL'], 390 'url': extension['updateURL'],
386 'version': extension['version'] 391 'version': extension['version']
387 } 392 }
388 writeLibabpUpdateManifest(path, updates) 393 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