Left: | ||
Right: |
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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
200 | 200 |
201 command = ['hg', '-R', self.repository, 'cat', '-r', version, os.path.jo in(self.repository, filename)] | 201 command = ['hg', '-R', self.repository, 'cat', '-r', version, os.path.jo in(self.repository, filename)] |
202 result = subprocess.check_output(command) | 202 result = subprocess.check_output(command) |
203 | 203 |
204 parser = SafeConfigParser() | 204 parser = SafeConfigParser() |
205 parser.readfp(StringIO(result)) | 205 parser.readfp(StringIO(result)) |
206 | 206 |
207 return parser | 207 return parser |
208 | 208 |
209 def getDownloads(self): | 209 def getDownloads(self): |
210 metadata = self.readMetadata() | 210 metadata = self.readMetadata(self.revision) |
Sebastian Noack
2016/11/25 13:01:56
I think this logic belongs into readMetadata(), so
Jon Sonesen
2016/11/25 13:05:01
I agree here.
Sebastian Noack
2016/11/25 13:40:29
For reference, we discussed that a little more on
| |
211 if metadata: | 211 if metadata: |
212 prefix = metadata.get('general', 'basename') | 212 prefix = metadata.get('general', 'basename') |
213 else: | 213 else: |
214 prefix = os.path.basename(os.path.normpath(self.repository)) | 214 prefix = os.path.basename(os.path.normpath(self.repository)) |
215 prefix += '-' | 215 prefix += '-' |
216 | 216 |
217 command = ['hg', 'locate', '-R', self.downloadsRepo, '-r', 'default'] | 217 command = ['hg', 'locate', '-R', self.downloadsRepo, '-r', 'default'] |
218 for filename in subprocess.check_output(command).splitlines(): | 218 for filename in subprocess.check_output(command).splitlines(): |
219 if filename.startswith(prefix) and filename.endswith(self.packageSuf fix): | 219 if filename.startswith(prefix) and filename.endswith(self.packageSuf fix): |
220 yield (filename, filename[len(prefix):len(filename) - len(self.p ackageSuffix)]) | 220 yield (filename, filename[len(prefix):len(filename) - len(self.p ackageSuffix)]) |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
309 | 309 |
310 | 310 |
311 def getDownloadLinks(result): | 311 def getDownloadLinks(result): |
312 """ | 312 """ |
313 gets the download links for all extensions and puts them into the config | 313 gets the download links for all extensions and puts them into the config |
314 object | 314 object |
315 """ | 315 """ |
316 for repo in Configuration.getRepositoryConfigurations(): | 316 for repo in Configuration.getRepositoryConfigurations(): |
317 try: | 317 try: |
318 (downloadURL, version) = _getDownloadLink(repo) | 318 (downloadURL, version) = _getDownloadLink(repo) |
319 if downloadURL is None: | |
320 message = 'No download link found for repo: ' + repo | |
Sebastian Noack
2016/11/25 13:01:56
Any reason you don't pass the message directly to
Jon Sonesen
2016/11/25 13:05:01
I had it in an if statement when i was testing it
| |
321 raise Exception(message) | |
319 except: | 322 except: |
320 traceback.print_exc() | 323 traceback.print_exc() |
321 continue | 324 continue |
322 if not result.has_section(repo.repositoryName): | 325 if not result.has_section(repo.repositoryName): |
323 result.add_section(repo.repositoryName) | 326 result.add_section(repo.repositoryName) |
324 result.set(repo.repositoryName, 'downloadURL', downloadURL) | 327 result.set(repo.repositoryName, 'downloadURL', downloadURL) |
325 result.set(repo.repositoryName, 'version', version) | 328 result.set(repo.repositoryName, 'version', version) |
326 | 329 |
327 qrcode = _getQRCode(downloadURL) | 330 qrcode = _getQRCode(downloadURL) |
328 if qrcode is not None: | 331 if qrcode is not None: |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
375 if not extensions: | 378 if not extensions: |
376 return | 379 return |
377 | 380 |
378 updates = {} | 381 updates = {} |
379 for extension in extensions: | 382 for extension in extensions: |
380 updates[extension['basename']] = { | 383 updates[extension['basename']] = { |
381 'url': extension['updateURL'], | 384 'url': extension['updateURL'], |
382 'version': extension['version'] | 385 'version': extension['version'] |
383 } | 386 } |
384 writeLibabpUpdateManifest(path, updates) | 387 writeLibabpUpdateManifest(path, updates) |
OLD | NEW |