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

Delta Between Two Patch Sets: sitescripts/extensions/utils.py

Issue 6270530592178176: Issue 1144 - Generate IE update manifests (Closed)
Left Patch Set: Created July 25, 2014, 1:06 p.m.
Right Patch Set: Import writeIEUpdateManifest as doWrite in the function body Created July 30, 2014, 2:22 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « sitescripts/extensions/bin/updateUpdateManifests.py ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 # coding: utf-8 1 # coding: utf-8
2 2
3 # This file is part of the Adblock Plus web scripts, 3 # This file is part of the Adblock Plus web scripts,
4 # Copyright (C) 2006-2014 Eyeo GmbH 4 # Copyright (C) 2006-2014 Eyeo GmbH
5 # 5 #
6 # Adblock Plus is free software: you can redistribute it and/or modify 6 # Adblock Plus is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License version 3 as 7 # it under the terms of the GNU General Public License version 3 as
8 # published by the Free Software Foundation. 8 # published by the Free Software Foundation.
9 # 9 #
10 # Adblock Plus is distributed in the hope that it will be useful, 10 # Adblock Plus is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details. 13 # GNU General Public License for more details.
14 # 14 #
15 # You should have received a copy of the GNU General Public License 15 # You should have received a copy of the GNU General Public License
16 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 16 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
17 17
18 import codecs
18 import os 19 import os
20 import json
19 import re 21 import re
20 import subprocess 22 import subprocess
21 import time 23 import time
22 import urlparse 24 import urlparse
23 import urllib 25 import urllib
24 import urllib2 26 import urllib2
25 import xml.dom.minidom as dom 27 import xml.dom.minidom as dom
26 from ConfigParser import SafeConfigParser, NoOptionError 28 from ConfigParser import SafeConfigParser, NoOptionError
27 from StringIO import StringIO 29 from StringIO import StringIO
28 from sitescripts.utils import get_config 30 from sitescripts.utils import get_config
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 if downloadURL == None: 392 if downloadURL == None:
391 continue 393 continue
392 if not result.has_section(repo.repositoryName): 394 if not result.has_section(repo.repositoryName):
393 result.add_section(repo.repositoryName) 395 result.add_section(repo.repositoryName)
394 result.set(repo.repositoryName, "downloadURL", downloadURL) 396 result.set(repo.repositoryName, "downloadURL", downloadURL)
395 result.set(repo.repositoryName, "version", version) 397 result.set(repo.repositoryName, "version", version)
396 398
397 qrcode = _getQRCode(downloadURL) 399 qrcode = _getQRCode(downloadURL)
398 if qrcode != None: 400 if qrcode != None:
399 result.set(repo.repositoryName, "qrcode", qrcode) 401 result.set(repo.repositoryName, "qrcode", qrcode)
402
403 def writeLibabpUpdateManifest(path, updates):
404 """
405 Writes update.json file for libadblockplus
406 """
407
408 baseDir = os.path.dirname(path)
409 if not os.path.exists(baseDir):
410 os.makedirs(baseDir)
411
412 handle = codecs.open(path, "wb", encoding="UTF-8")
413 json.dump(updates, handle, ensure_ascii=False, indent=2, separators=(",", ": " ))
414 handle.close()
415
416 def writeIEUpdateManifest(path, extensions):
417 """
418 Writes update.json for IE
419 """
420
421 if not extensions:
422 return
423
424 updates = {}
425 for extension in extensions:
426 basename = extension['basename']
427 updateURL = extension['updateURL']
428 version = extension['version']
429 updates["%s/%s" % (basename, "msie64")] = {
430 "url": updateURL.replace(".exe", "-x64.msi"),
431 "version": version
432 }
433 updates["%s/%s" % (basename, "msie32")] = {
434 "url": updateURL.replace(".exe", "-x86.msi"),
435 "version": version
436 }
437 writeLibabpUpdateManifest(path, updates)
LEFTRIGHT

Powered by Google App Engine
This is Rietveld