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

Unified Diff: sitescripts/extensions/utils.py

Issue 6270530592178176: Issue 1144 - Generate IE update manifests (Closed)
Patch Set: Import writeIEUpdateManifest as doWrite in the function body Created July 30, 2014, 2:22 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sitescripts/extensions/bin/updateUpdateManifests.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sitescripts/extensions/utils.py
===================================================================
--- a/sitescripts/extensions/utils.py
+++ b/sitescripts/extensions/utils.py
@@ -15,7 +15,9 @@
# You should have received a copy of the GNU General Public License
# along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
+import codecs
import os
+import json
import re
import subprocess
import time
@@ -397,3 +399,39 @@
qrcode = _getQRCode(downloadURL)
if qrcode != None:
result.set(repo.repositoryName, "qrcode", qrcode)
+
+def writeLibabpUpdateManifest(path, updates):
+ """
+ Writes update.json file for libadblockplus
+ """
+
+ baseDir = os.path.dirname(path)
+ if not os.path.exists(baseDir):
+ os.makedirs(baseDir)
+
+ handle = codecs.open(path, "wb", encoding="UTF-8")
+ json.dump(updates, handle, ensure_ascii=False, indent=2, separators=(",", ": "))
+ handle.close()
+
+def writeIEUpdateManifest(path, extensions):
+ """
+ Writes update.json for IE
+ """
+
+ if not extensions:
+ return
+
+ updates = {}
+ for extension in extensions:
+ basename = extension['basename']
+ updateURL = extension['updateURL']
+ version = extension['version']
+ updates["%s/%s" % (basename, "msie64")] = {
+ "url": updateURL.replace(".exe", "-x64.msi"),
+ "version": version
+ }
+ updates["%s/%s" % (basename, "msie32")] = {
+ "url": updateURL.replace(".exe", "-x86.msi"),
+ "version": version
+ }
+ writeLibabpUpdateManifest(path, updates)
« no previous file with comments | « sitescripts/extensions/bin/updateUpdateManifests.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld