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

Side by Side Diff: sitescripts/extensions/bin/updateUpdateManifests.py

Issue 6723860867055616: Issue 1048 - Generate Android update manifests in the libadblockplus format (Closed)
Patch Set: Created Sept. 12, 2014, 12:08 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 | « .sitescripts.example ('k') | 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 # 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,
(...skipping 12 matching lines...) Expand all
23 """ 23 """
24 24
25 import os 25 import os
26 import re 26 import re
27 import subprocess 27 import subprocess
28 from buildtools.packagerGecko import KNOWN_APPS 28 from buildtools.packagerGecko import KNOWN_APPS
29 from ConfigParser import SafeConfigParser 29 from ConfigParser import SafeConfigParser
30 from sitescripts.utils import get_config, get_template 30 from sitescripts.utils import get_config, get_template
31 from sitescripts.extensions.utils import ( 31 from sitescripts.extensions.utils import (
32 Configuration, getDownloadLinks, getSafariCertificateID, 32 Configuration, getDownloadLinks, getSafariCertificateID,
33 writeIEUpdateManifest) 33 writeIEUpdateManifest, writeLibabpUpdateManifest)
34 from sitescripts.extensions.android import get_min_sdk_version 34 from sitescripts.extensions.android import get_min_sdk_version
35 35
36 def readMetadata(repo, version): 36 def readMetadata(repo, version):
37 """ 37 """
38 reads extension ID and compatibility information from metadata file in the 38 reads extension ID and compatibility information from metadata file in the
39 extension's repository 39 extension's repository
40 """ 40 """
41 if repo.type == 'android': 41 if repo.type == 'android':
42 command = ['hg', '-R', repo.repository, 'id', '-r', version, '-n'] 42 command = ['hg', '-R', repo.repository, 'id', '-r', version, '-n']
43 result = subprocess.check_output(command) 43 result = subprocess.check_output(command)
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 extensions[repo.type].append(data) 91 extensions[repo.type].append(data)
92 92
93 if len(extensions['android']) > 1: 93 if len(extensions['android']) > 1:
94 print >>sys.stderr, 'Warning: more than one Android app defined, update mani fest only works for one' 94 print >>sys.stderr, 'Warning: more than one Android app defined, update mani fest only works for one'
95 95
96 for repoType in extensions.iterkeys(): 96 for repoType in extensions.iterkeys():
97 manifestPath = get_config().get('extensions', '%sUpdateManifestPath' % repoT ype) 97 manifestPath = get_config().get('extensions', '%sUpdateManifestPath' % repoT ype)
98 if repoType == 'ie': 98 if repoType == 'ie':
99 writeIEUpdateManifest(manifestPath, extensions[repoType]) 99 writeIEUpdateManifest(manifestPath, extensions[repoType])
100 else: 100 else:
101 # ABP for Android used to have its own update manifest format. We need to
102 # generate both that and the new one in the libadblockplus format as long
103 # as a significant amount of users is on an old version.
104 if repoType == 'android':
105 newManifestPath = get_config().get("extensions",
106 "androidNewUpdateManifestPath")
107 writeLibabpUpdateManifest(newManifestPath, extensions[repoType])
101 template = get_template(get_config().get('extensions', '%sUpdateManifest' % repoType)) 108 template = get_template(get_config().get('extensions', '%sUpdateManifest' % repoType))
102 template.stream({'extensions': extensions[repoType]}).dump(manifestPath) 109 template.stream({'extensions': extensions[repoType]}).dump(manifestPath)
103 110
104 def updateUpdateManifests(): 111 def updateUpdateManifests():
105 """ 112 """
106 updates all update manifests with the current versions 113 updates all update manifests with the current versions
107 """ 114 """
108 115
109 parser = SafeConfigParser() 116 parser = SafeConfigParser()
110 getDownloadLinks(parser) 117 getDownloadLinks(parser)
111 writeUpdateManifest(parser) 118 writeUpdateManifest(parser)
112 119
113 if __name__ == "__main__": 120 if __name__ == "__main__":
114 updateUpdateManifests() 121 updateUpdateManifests()
OLDNEW
« no previous file with comments | « .sitescripts.example ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld