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

Side by Side Diff: sitescripts/extensions/utils.py

Issue 8327353: Crawler backend (Closed)
Patch Set: Created Sept. 14, 2012, 2:23 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 # coding: utf-8 1 # coding: utf-8
2 2
3 # This Source Code is subject to the terms of the Mozilla Public License 3 # This Source Code is subject to the terms of the Mozilla Public License
4 # version 2.0 (the "License"). You can obtain a copy of the License at 4 # version 2.0 (the "License"). You can obtain a copy of the License at
5 # http://mozilla.org/MPL/2.0/. 5 # http://mozilla.org/MPL/2.0/.
6 6
7 import re 7 import re
8 from ConfigParser import NoOptionError 8 from ConfigParser import NoOptionError
9 from sitescripts.utils import get_config 9 from sitescripts.utils import get_config
10 10
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 self.type = self.config.get('extensions', self.repositoryName + '_type') 145 self.type = self.config.get('extensions', self.repositoryName + '_type')
146 else: 146 else:
147 self.type = 'gecko' 147 self.type = 'gecko'
148 148
149 if self.type == 'gecko': 149 if self.type == 'gecko':
150 self.packageSuffix = '.xpi' 150 self.packageSuffix = '.xpi'
151 elif self.type == 'chrome': 151 elif self.type == 'chrome':
152 self.packageSuffix = '.crx' 152 self.packageSuffix = '.crx'
153 elif self.type == 'kmeleon': 153 elif self.type == 'kmeleon':
154 self.packageSuffix = '.zip' 154 self.packageSuffix = '.zip'
155 elif self.type == 'android':
156 self.packageSuffix = '.apk'
155 157
156 if self.nightlyConfig and not self.nightlyConfig.has_section(self.repository Name): 158 if self.nightlyConfig and not self.nightlyConfig.has_section(self.repository Name):
157 self.nightlyConfig.add_section(self.repositoryName) 159 self.nightlyConfig.add_section(self.repositoryName)
158 160
159 def __str__(self): 161 def __str__(self):
160 """ 162 """
161 Provides a string representation of this configuration 163 Provides a string representation of this configuration
162 """ 164 """
163 return self.repositoryName 165 return self.repositoryName
164 166
165 @staticmethod 167 @staticmethod
166 def getRepositoryConfigurations(nightlyConfig = None): 168 def getRepositoryConfigurations(nightlyConfig = None):
167 """ 169 """
168 Retrieves configuration settings for all repositories 170 Retrieves configuration settings for all repositories
169 from the configuration file, where existing repositories 171 from the configuration file, where existing repositories
170 are identified by an <id>_repository entry appearing 172 are identified by an <id>_repository entry appearing
171 in the configuration file. 173 in the configuration file.
172 This static method will enumerate Configuration 174 This static method will enumerate Configuration
173 objects representing the settings for each repository. 175 objects representing the settings for each repository.
174 """ 176 """
175 config = get_config() 177 config = get_config()
176 for key, value in config.items("extensions"): 178 for key, value in config.items("extensions"):
177 if key.endswith("_repository"): 179 if key.endswith("_repository"):
178 repositoryName = re.sub(r'_repository$', '', key) 180 repositoryName = re.sub(r'_repository$', '', key)
179 if repositoryName: 181 if repositoryName:
180 yield Configuration(config, nightlyConfig, repositoryName, value) 182 yield Configuration(config, nightlyConfig, repositoryName, value)
OLDNEW

Powered by Google App Engine
This is Rietveld