OLD | NEW |
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-2013 Eyeo GmbH | 4 # Copyright (C) 2006-2013 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 154 |
155 if self.config.has_option('extensions', self.repositoryName + '_type'): | 155 if self.config.has_option('extensions', self.repositoryName + '_type'): |
156 self.type = self.config.get('extensions', self.repositoryName + '_type') | 156 self.type = self.config.get('extensions', self.repositoryName + '_type') |
157 else: | 157 else: |
158 self.type = 'gecko' | 158 self.type = 'gecko' |
159 | 159 |
160 if self.type == 'gecko': | 160 if self.type == 'gecko': |
161 self.packageSuffix = '.xpi' | 161 self.packageSuffix = '.xpi' |
162 elif self.type == 'chrome' or self.type == 'opera': | 162 elif self.type == 'chrome' or self.type == 'opera': |
163 self.packageSuffix = '.crx' | 163 self.packageSuffix = '.crx' |
164 elif self.type == 'kmeleon': | 164 elif self.type == 'ie': |
165 self.packageSuffix = '.zip' | 165 self.packageSuffix = '-x64.msi' |
166 elif self.type == 'android': | 166 elif self.type == 'android': |
167 self.packageSuffix = '.apk' | 167 self.packageSuffix = '.apk' |
168 | 168 |
169 if self.nightlyConfig and not self.nightlyConfig.has_section(self.repository
Name): | 169 if self.nightlyConfig and not self.nightlyConfig.has_section(self.repository
Name): |
170 self.nightlyConfig.add_section(self.repositoryName) | 170 self.nightlyConfig.add_section(self.repositoryName) |
171 | 171 |
172 def __str__(self): | 172 def __str__(self): |
173 """ | 173 """ |
174 Provides a string representation of this configuration | 174 Provides a string representation of this configuration |
175 """ | 175 """ |
176 return self.repositoryName | 176 return self.repositoryName |
177 | 177 |
178 @staticmethod | 178 @staticmethod |
179 def getRepositoryConfigurations(nightlyConfig = None): | 179 def getRepositoryConfigurations(nightlyConfig = None): |
180 """ | 180 """ |
181 Retrieves configuration settings for all repositories | 181 Retrieves configuration settings for all repositories |
182 from the configuration file, where existing repositories | 182 from the configuration file, where existing repositories |
183 are identified by an <id>_repository entry appearing | 183 are identified by an <id>_repository entry appearing |
184 in the configuration file. | 184 in the configuration file. |
185 This static method will enumerate Configuration | 185 This static method will enumerate Configuration |
186 objects representing the settings for each repository. | 186 objects representing the settings for each repository. |
187 """ | 187 """ |
188 config = get_config() | 188 config = get_config() |
189 for key, value in config.items("extensions"): | 189 for key, value in config.items("extensions"): |
190 if key.endswith("_repository"): | 190 if key.endswith("_repository"): |
191 repositoryName = re.sub(r'_repository$', '', key) | 191 repositoryName = re.sub(r'_repository$', '', key) |
192 if repositoryName: | 192 if repositoryName: |
193 yield Configuration(config, nightlyConfig, repositoryName, value) | 193 yield Configuration(config, nightlyConfig, repositoryName, value) |
OLD | NEW |