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

Delta Between Two Patch Sets: sitescripts/extensions/bin/updateUpdateManifests.py

Issue 6349778342379520: Issue 1048 - Fix Android update manifest format (Closed)
Left Patch Set: Created Sept. 18, 2014, 3:42 p.m.
Right Patch Set: Remove pointless del, don't hard code basename Created Sept. 19, 2014, 2:25 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | 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
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 29 matching lines...) Expand all
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)
44 revision = re.sub(r'\D', '', result) 44 revision = re.sub(r'\D', '', result)
45 45
46 return { 46 return {
47 'revision': revision, 47 'revision': revision,
48 'version': version, 48 'version': version,
49 'minSdkVersion': get_min_sdk_version(repo, version), 49 'minSdkVersion': get_min_sdk_version(repo, version),
50 'basename': os.path.basename(repo.repository)
50 } 51 }
51 elif repo.type == 'safari': 52 elif repo.type == 'safari':
52 metadata = repo.readMetadata(version) 53 metadata = repo.readMetadata(version)
53 return { 54 return {
54 'certificateID': getSafariCertificateID(repo.keyFile), 55 'certificateID': getSafariCertificateID(repo.keyFile),
55 'version': version, 56 'version': version,
56 'shortVersion': version, 57 'shortVersion': version,
57 'basename': metadata.get('general', 'basename'), 58 'basename': metadata.get('general', 'basename'),
58 } 59 }
59 elif repo.type == 'gecko': 60 elif repo.type == 'gecko':
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 manifestPath = get_config().get('extensions', '%sUpdateManifestPath' % repoT ype) 99 manifestPath = get_config().get('extensions', '%sUpdateManifestPath' % repoT ype)
99 if repoType == 'ie': 100 if repoType == 'ie':
100 writeIEUpdateManifest(manifestPath, extensions[repoType]) 101 writeIEUpdateManifest(manifestPath, extensions[repoType])
101 else: 102 else:
102 # ABP for Android used to have its own update manifest format. We need to 103 # ABP for Android used to have its own update manifest format. We need to
103 # generate both that and the new one in the libadblockplus format as long 104 # generate both that and the new one in the libadblockplus format as long
104 # as a significant amount of users is on an old version. 105 # as a significant amount of users is on an old version.
105 if repoType == 'android': 106 if repoType == 'android':
106 newManifestPath = get_config().get("extensions", 107 newManifestPath = get_config().get("extensions",
107 "androidNewUpdateManifestPath") 108 "androidNewUpdateManifestPath")
108 data = extensions[repoType][0] 109 updates = {}
109 updates = { 110 for extension in extensions[repoType]:
110 'adblockplusandroid': { 111 updates[extension['basename']] = {
Wladimir Palant 2014/09/18 18:49:40 This shouldn't be hardcoded. Please add a basename
Felix Dahlke 2014/09/19 02:25:52 Done.
111 'version': data['version'], 112 'version': extension['version'],
112 'url': data['updateURL'] 113 'url': extension['updateURL']
113 } 114 }
114 }
115 writeLibabpUpdateManifest(newManifestPath, updates) 115 writeLibabpUpdateManifest(newManifestPath, updates)
116 del data['version']
Wladimir Palant 2014/09/18 18:49:40 This shouldn't be necessary, the template will ign
Felix Dahlke 2014/09/19 02:25:52 Done.
117 template = get_template(get_config().get('extensions', '%sUpdateManifest' % repoType)) 116 template = get_template(get_config().get('extensions', '%sUpdateManifest' % repoType))
118 template.stream({'extensions': extensions[repoType]}).dump(manifestPath) 117 template.stream({'extensions': extensions[repoType]}).dump(manifestPath)
119 118
120 def updateUpdateManifests(): 119 def updateUpdateManifests():
121 """ 120 """
122 updates all update manifests with the current versions 121 updates all update manifests with the current versions
123 """ 122 """
124 123
125 parser = SafeConfigParser() 124 parser = SafeConfigParser()
126 getDownloadLinks(parser) 125 getDownloadLinks(parser)
127 writeUpdateManifest(parser) 126 writeUpdateManifest(parser)
128 127
129 if __name__ == "__main__": 128 if __name__ == "__main__":
130 updateUpdateManifests() 129 updateUpdateManifests()
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld