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

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

Issue 6349778342379520: Issue 1048 - Fix Android update manifest format (Closed)
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:
View unified diff | Download patch
« no previous file with comments | « no previous file | 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 27 matching lines...) Expand all
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)
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 'minSdkVersion': get_min_sdk_version(repo, version), 49 'minSdkVersion': get_min_sdk_version(repo, version),
50 'basename': os.path.basename(repo.repository)
49 } 51 }
50 elif repo.type == 'safari': 52 elif repo.type == 'safari':
51 metadata = repo.readMetadata(version) 53 metadata = repo.readMetadata(version)
52 return { 54 return {
53 'certificateID': getSafariCertificateID(repo.keyFile), 55 'certificateID': getSafariCertificateID(repo.keyFile),
54 'version': version, 56 'version': version,
55 'shortVersion': version, 57 'shortVersion': version,
56 'basename': metadata.get('general', 'basename'), 58 'basename': metadata.get('general', 'basename'),
57 } 59 }
58 elif repo.type == 'gecko': 60 elif repo.type == 'gecko':
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 manifestPath = get_config().get('extensions', '%sUpdateManifestPath' % repoT ype) 99 manifestPath = get_config().get('extensions', '%sUpdateManifestPath' % repoT ype)
98 if repoType == 'ie': 100 if repoType == 'ie':
99 writeIEUpdateManifest(manifestPath, extensions[repoType]) 101 writeIEUpdateManifest(manifestPath, extensions[repoType])
100 else: 102 else:
101 # 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
102 # 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
103 # as a significant amount of users is on an old version. 105 # as a significant amount of users is on an old version.
104 if repoType == 'android': 106 if repoType == 'android':
105 newManifestPath = get_config().get("extensions", 107 newManifestPath = get_config().get("extensions",
106 "androidNewUpdateManifestPath") 108 "androidNewUpdateManifestPath")
107 writeLibabpUpdateManifest(newManifestPath, extensions[repoType]) 109 updates = {}
110 for extension in extensions[repoType]:
111 updates[extension['basename']] = {
112 'version': extension['version'],
113 'url': extension['updateURL']
114 }
115 writeLibabpUpdateManifest(newManifestPath, updates)
108 template = get_template(get_config().get('extensions', '%sUpdateManifest' % repoType)) 116 template = get_template(get_config().get('extensions', '%sUpdateManifest' % repoType))
109 template.stream({'extensions': extensions[repoType]}).dump(manifestPath) 117 template.stream({'extensions': extensions[repoType]}).dump(manifestPath)
110 118
111 def updateUpdateManifests(): 119 def updateUpdateManifests():
112 """ 120 """
113 updates all update manifests with the current versions 121 updates all update manifests with the current versions
114 """ 122 """
115 123
116 parser = SafeConfigParser() 124 parser = SafeConfigParser()
117 getDownloadLinks(parser) 125 getDownloadLinks(parser)
118 writeUpdateManifest(parser) 126 writeUpdateManifest(parser)
119 127
120 if __name__ == "__main__": 128 if __name__ == "__main__":
121 updateUpdateManifests() 129 updateUpdateManifests()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld