OLD | NEW |
1 # This file is part of the Adblock Plus web scripts, | 1 # This file is part of the Adblock Plus web scripts, |
2 # Copyright (C) 2006-2016 Eyeo GmbH | 2 # Copyright (C) 2006-2016 Eyeo GmbH |
3 # | 3 # |
4 # Adblock Plus is free software: you can redistribute it and/or modify | 4 # Adblock Plus is free software: you can redistribute it and/or modify |
5 # it under the terms of the GNU General Public License version 3 as | 5 # it under the terms of the GNU General Public License version 3 as |
6 # published by the Free Software Foundation. | 6 # published by the Free Software Foundation. |
7 # | 7 # |
8 # Adblock Plus is distributed in the hope that it will be useful, | 8 # Adblock Plus is distributed in the hope that it will be useful, |
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 writes an update manifest for all extensions and Android apps | 90 writes an update manifest for all extensions and Android apps |
91 """ | 91 """ |
92 | 92 |
93 extensions = {'gecko': [], 'android': [], 'safari': [], 'ie': []} | 93 extensions = {'gecko': [], 'android': [], 'safari': [], 'ie': []} |
94 for repo in Configuration.getRepositoryConfigurations(): | 94 for repo in Configuration.getRepositoryConfigurations(): |
95 if repo.type not in extensions or not links.has_section(repo.repositoryN
ame): | 95 if repo.type not in extensions or not links.has_section(repo.repositoryN
ame): |
96 continue | 96 continue |
97 data = readMetadata(repo, links.get(repo.repositoryName, 'version')) | 97 data = readMetadata(repo, links.get(repo.repositoryName, 'version')) |
98 data['updateURL'] = links.get(repo.repositoryName, 'downloadURL') | 98 data['updateURL'] = links.get(repo.repositoryName, 'downloadURL') |
99 if data['updateURL'].startswith(repo.downloadsURL): | 99 if data['updateURL'].startswith(repo.downloadsURL): |
100 data['updateURL'] += "?update" | 100 data['updateURL'] += '?update' |
101 extensions[repo.type].append(data) | 101 extensions[repo.type].append(data) |
102 | 102 |
103 if len(extensions['android']) > 1: | 103 if len(extensions['android']) > 1: |
104 print >>sys.stderr, 'Warning: more than one Android app defined, update
manifest only works for one' | 104 print >>sys.stderr, 'Warning: more than one Android app defined, update
manifest only works for one' |
105 | 105 |
106 for repoType in extensions.iterkeys(): | 106 for repoType in extensions.iterkeys(): |
107 manifestPath = get_config().get('extensions', '%sUpdateManifestPath' % r
epoType) | 107 manifestPath = get_config().get('extensions', '%sUpdateManifestPath' % r
epoType) |
108 if repoType == 'ie': | 108 if repoType == 'ie': |
109 writeIEUpdateManifest(manifestPath, extensions[repoType]) | 109 writeIEUpdateManifest(manifestPath, extensions[repoType]) |
110 else: | 110 else: |
111 # ABP for Android used to have its own update manifest format. We ne
ed to | 111 # ABP for Android used to have its own update manifest format. We ne
ed to |
112 # generate both that and the new one in the libadblockplus format as
long | 112 # generate both that and the new one in the libadblockplus format as
long |
113 # as a significant amount of users is on an old version. | 113 # as a significant amount of users is on an old version. |
114 if repoType == 'android': | 114 if repoType == 'android': |
115 newManifestPath = get_config().get("extensions", | 115 newManifestPath = get_config().get('extensions', |
116 "androidNewUpdateManifestPath
") | 116 'androidNewUpdateManifestPath
') |
117 writeAndroidUpdateManifest(newManifestPath, extensions[repoType]
) | 117 writeAndroidUpdateManifest(newManifestPath, extensions[repoType]
) |
118 template = get_template(get_config().get('extensions', '%sUpdateMani
fest' % repoType)) | 118 template = get_template(get_config().get('extensions', '%sUpdateMani
fest' % repoType)) |
119 template.stream({'extensions': extensions[repoType]}).dump(manifestP
ath) | 119 template.stream({'extensions': extensions[repoType]}).dump(manifestP
ath) |
120 | 120 |
121 | 121 |
122 def updateUpdateManifests(): | 122 def updateUpdateManifests(): |
123 """ | 123 """ |
124 updates all update manifests with the current versions | 124 updates all update manifests with the current versions |
125 """ | 125 """ |
126 | 126 |
127 parser = SafeConfigParser() | 127 parser = SafeConfigParser() |
128 getDownloadLinks(parser) | 128 getDownloadLinks(parser) |
129 writeUpdateManifest(parser) | 129 writeUpdateManifest(parser) |
130 | 130 |
131 if __name__ == "__main__": | 131 if __name__ == '__main__': |
132 updateUpdateManifests() | 132 updateUpdateManifests() |
OLD | NEW |