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

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

Issue 29337957: Issue 3759 - Removed PAD generation code (Closed)
Patch Set: Created March 8, 2016, 4:31 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 file is part of the Adblock Plus web scripts, 3 # This file is part of the Adblock Plus web scripts,
4 # Copyright (C) 2006-2016 Eyeo GmbH 4 # Copyright (C) 2006-2016 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 buildRepository = _defineProperty('buildRepository') 128 buildRepository = _defineProperty('buildRepository')
129 nightliesDirectory = _defineProperty('nightliesDirectory') 129 nightliesDirectory = _defineProperty('nightliesDirectory')
130 nightliesURL = _defineProperty('nightliesURL') 130 nightliesURL = _defineProperty('nightliesURL')
131 downloadsRepo = _defineProperty('downloadsRepo') 131 downloadsRepo = _defineProperty('downloadsRepo')
132 downloadsURL = _defineProperty('downloadsURL') 132 downloadsURL = _defineProperty('downloadsURL')
133 docsDirectory = _defineProperty('docsDirectory') 133 docsDirectory = _defineProperty('docsDirectory')
134 signtool = _defineProperty('signtool') 134 signtool = _defineProperty('signtool')
135 certname = _defineProperty('signtool_certname') 135 certname = _defineProperty('signtool_certname')
136 dbdir = _defineProperty('signtool_dbdir') 136 dbdir = _defineProperty('signtool_dbdir')
137 dbpass = _defineProperty('signtool_dbpass') 137 dbpass = _defineProperty('signtool_dbpass')
138 padDirectory = _defineProperty('padDirectory')
139 padURL = _defineProperty('padURL')
140 padTemplate = _defineProperty('padTemplate')
141 138
142 keyFile = _defineProperty('key', local=True, default='') 139 keyFile = _defineProperty('key', local=True, default='')
143 name = _defineProperty('name', local=True) 140 name = _defineProperty('name', local=True)
144 galleryID = _defineProperty('galleryID', local=True, default='') 141 galleryID = _defineProperty('galleryID', local=True, default='')
145 devbuildGalleryID = _defineProperty('devbuildGalleryID', local=True, default=' ') 142 devbuildGalleryID = _defineProperty('devbuildGalleryID', local=True, default=' ')
146 downloadPage = _defineProperty('downloadPage', local=True, default='') 143 downloadPage = _defineProperty('downloadPage', local=True, default='')
147 experimental = _defineProperty('experimental', local=True, default='') 144 experimental = _defineProperty('experimental', local=True, default='')
148 clientID = _defineProperty('clientID', local=True, default='') 145 clientID = _defineProperty('clientID', local=True, default='')
149 clientSecret = _defineProperty('clientSecret', local=True, default='') 146 clientSecret = _defineProperty('clientSecret', local=True, default='')
150 refreshToken = _defineProperty('refreshToken', local=True, default='') 147 refreshToken = _defineProperty('refreshToken', local=True, default='')
151 pad = _defineProperty('pad', local=True, type='boolean', default=False)
152 148
153 latestRevision = _defineNightlyProperty('latestRevision') 149 latestRevision = _defineNightlyProperty('latestRevision')
154 150
155 def __init__(self, config, nightlyConfig, repositoryName, repository): 151 def __init__(self, config, nightlyConfig, repositoryName, repository):
156 """ 152 """
157 Creates a new Configuration instance that is bound to a particular 153 Creates a new Configuration instance that is bound to a particular
158 repository. 154 repository.
159 """ 155 """
160 156
161 self.repositoryName = repositoryName 157 self.repositoryName = repositoryName
(...skipping 19 matching lines...) Expand all
181 177
182 if self.nightlyConfig and not self.nightlyConfig.has_section(self.repository Name): 178 if self.nightlyConfig and not self.nightlyConfig.has_section(self.repository Name):
183 self.nightlyConfig.add_section(self.repositoryName) 179 self.nightlyConfig.add_section(self.repositoryName)
184 180
185 def __str__(self): 181 def __str__(self):
186 """ 182 """
187 Provides a string representation of this configuration 183 Provides a string representation of this configuration
188 """ 184 """
189 return self.repositoryName 185 return self.repositoryName
190 186
191 def listContents(self, version='tip'):
192 return subprocess.check_output(['hg', '-R', self.repository, 'locate', '-r', version]).splitlines()
193
194 def readMetadata(self, version='tip'): 187 def readMetadata(self, version='tip'):
195 genericFilename = 'metadata' 188 genericFilename = 'metadata'
196 filename = '%s.%s' % (genericFilename, self.type) 189 filename = '%s.%s' % (genericFilename, self.type)
197 files = self.listContents(version) 190 files = subprocess.check_output(['hg', '-R', self.repository,
191 'locate', '-r', version]).splitlines()
198 192
199 if filename not in files: 193 if filename not in files:
200 # some repositories like those for Android and 194 # some repositories like those for Android and
201 # Internet Explorer don't have metadata files 195 # Internet Explorer don't have metadata files
202 if genericFilename not in files: 196 if genericFilename not in files:
203 return None 197 return None
204 198
205 # Fall back to platform-independent metadata file 199 # Fall back to platform-independent metadata file
206 filename = genericFilename 200 filename = genericFilename
207 201
208 command = ['hg', '-R', self.repository, 'cat', '-r', version, os.path.join(s elf.repository, filename)] 202 command = ['hg', '-R', self.repository, 'cat', '-r', version, os.path.join(s elf.repository, filename)]
209 result = subprocess.check_output(command) 203 result = subprocess.check_output(command)
210 204
211 parser = SafeConfigParser() 205 parser = SafeConfigParser()
212 parser.readfp(StringIO(result)) 206 parser.readfp(StringIO(result))
213 207
214 return parser 208 return parser
215 209
216 @property 210 def getDownloads(self):
217 def basename(self):
Wladimir Palant 2016/03/08 16:58:14 If I see it correctly, this property is still bein
Sebastian Noack 2016/03/08 17:01:02 If I see it correctly, we introduced that property
Wladimir Palant 2016/03/08 17:34:12 I didn't but there appears to be a separate Nightl
218 metadata = self.readMetadata() 211 metadata = self.readMetadata()
219 if metadata: 212 if metadata:
220 return metadata.get('general', 'basename') 213 prefix = metadata.get('general', 'basename')
221 return os.path.basename(os.path.normpath(self.repository)) 214 else:
215 prefix = os.path.basename(os.path.normpath(self.repository))
216 prefix += '-'
222 217
223 def getDownloads(self):
224 prefix = self.basename + '-'
225 command = ['hg', 'locate', '-R', self.downloadsRepo, '-r', 'default'] 218 command = ['hg', 'locate', '-R', self.downloadsRepo, '-r', 'default']
226
227 for filename in subprocess.check_output(command).splitlines(): 219 for filename in subprocess.check_output(command).splitlines():
228 if filename.startswith(prefix) and filename.endswith(self.packageSuffix): 220 if filename.startswith(prefix) and filename.endswith(self.packageSuffix):
229 yield (filename, filename[len(prefix):len(filename) - len(self.packageSu ffix)]) 221 yield (filename, filename[len(prefix):len(filename) - len(self.packageSu ffix)])
230 222
231 @staticmethod 223 @staticmethod
232 def getRepositoryConfigurations(nightlyConfig = None): 224 def getRepositoryConfigurations(nightlyConfig = None):
233 """ 225 """
234 Retrieves configuration settings for all repositories 226 Retrieves configuration settings for all repositories
235 from the configuration file, where existing repositories 227 from the configuration file, where existing repositories
236 are identified by an <id>_repository entry appearing 228 are identified by an <id>_repository entry appearing
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 if not extensions: 408 if not extensions:
417 return 409 return
418 410
419 updates = {} 411 updates = {}
420 for extension in extensions: 412 for extension in extensions:
421 updates[extension['basename']] = { 413 updates[extension['basename']] = {
422 "url": extension['updateURL'], 414 "url": extension['updateURL'],
423 "version": extension['version'] 415 "version": extension['version']
424 } 416 }
425 writeLibabpUpdateManifest(path, updates) 417 writeLibabpUpdateManifest(path, updates)
OLDNEW
« sitescripts/extensions/bin/updateDownloadLinks.py ('K') | « sitescripts/extensions/template/pad.xml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld