OLD | NEW |
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 | |
30 | 29 |
31 PACKAGE_SUFFIXES = { | 30 PACKAGE_SUFFIXES = { |
32 'gecko': '.xpi', | 31 'gecko': '.xpi', |
33 'gecko-webext': '.xpi', | 32 'gecko-webext': '.xpi', |
34 'chrome': '.crx', | 33 'chrome': '.crx', |
35 'safari': '.safariextz', | 34 'safari': '.safariextz', |
36 'ie': '.exe', | 35 'ie': '.exe', |
37 'android': '.apk' | 36 'android': '.apk' |
38 } | 37 } |
39 | 38 |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 """ | 313 """ |
315 gets the download links for all extensions and puts them into the config | 314 gets the download links for all extensions and puts them into the config |
316 object | 315 object |
317 """ | 316 """ |
318 for repo in Configuration.getRepositoryConfigurations(): | 317 for repo in Configuration.getRepositoryConfigurations(): |
319 try: | 318 try: |
320 (downloadURL, version) = _getDownloadLink(repo) | 319 (downloadURL, version) = _getDownloadLink(repo) |
321 if downloadURL is None: | 320 if downloadURL is None: |
322 raise Exception('No download link found for repo: ' + | 321 raise Exception('No download link found for repo: ' + |
323 repo.repositoryName) | 322 repo.repositoryName) |
324 except ExpatError: | |
325 traceback.print_exc() | |
326 print "Error found while parsing xml from %s link" % repo.repository
Name | |
327 continue | |
328 except: | 323 except: |
329 traceback.print_exc() | 324 traceback.print_exc() |
330 continue | 325 continue |
331 if not result.has_section(repo.repositoryName): | 326 if not result.has_section(repo.repositoryName): |
332 result.add_section(repo.repositoryName) | 327 result.add_section(repo.repositoryName) |
333 result.set(repo.repositoryName, 'downloadURL', downloadURL) | 328 result.set(repo.repositoryName, 'downloadURL', downloadURL) |
334 result.set(repo.repositoryName, 'version', version) | 329 result.set(repo.repositoryName, 'version', version) |
335 | 330 |
336 qrcode = _getQRCode(downloadURL) | 331 qrcode = _getQRCode(downloadURL) |
337 if qrcode is not None: | 332 if qrcode is not None: |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 if not extensions: | 379 if not extensions: |
385 return | 380 return |
386 | 381 |
387 updates = {} | 382 updates = {} |
388 for extension in extensions: | 383 for extension in extensions: |
389 updates[extension['basename']] = { | 384 updates[extension['basename']] = { |
390 'url': extension['updateURL'], | 385 'url': extension['updateURL'], |
391 'version': extension['version'] | 386 'version': extension['version'] |
392 } | 387 } |
393 writeLibabpUpdateManifest(path, updates) | 388 writeLibabpUpdateManifest(path, updates) |
OLD | NEW |