OLD | NEW |
| (Empty) |
1 # coding: utf-8 | |
2 | |
3 # This file is part of the Adblock Plus web scripts, | |
4 # Copyright (C) 2006-2016 Eyeo GmbH | |
5 # | |
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 | |
8 # published by the Free Software Foundation. | |
9 # | |
10 # Adblock Plus is distributed in the hope that it will be useful, | |
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 # GNU General Public License for more details. | |
14 # | |
15 # You should have received a copy of the GNU General Public License | |
16 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | |
17 | |
18 """ | |
19 Update the list of extenstions | |
20 ============================== | |
21 | |
22 This script generates a list of extensions and saves these with download links | |
23 and version information | |
24 """ | |
25 | |
26 from ConfigParser import SafeConfigParser | |
27 from sitescripts.utils import get_config | |
28 from sitescripts.extensions.utils import Configuration, getDownloadLinks | |
29 from sitescripts.extensions.pad import PadFile | |
30 | |
31 def writePadFile(links): | |
32 for repo in Configuration.getRepositoryConfigurations(): | |
33 if repo.pad and links.has_section(repo.repositoryName): | |
34 PadFile.forRepository(repo, links.get(repo.repositoryName, 'version'), | |
35 links.get(repo.repositoryName, 'downloadURL'))
.write() | |
36 | |
37 def updateLinks(): | |
38 """ | |
39 writes the current extension download links to a file | |
40 """ | |
41 | |
42 # Now get download links and save them to file | |
43 result = SafeConfigParser() | |
44 getDownloadLinks(result) | |
45 file = open(get_config().get('extensions', 'downloadLinksFile'), 'wb') | |
46 result.write(file) | |
47 file.close() | |
48 | |
49 writePadFile(result) | |
50 | |
51 if __name__ == "__main__": | |
52 updateLinks() | |
OLD | NEW |