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

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

Issue 6304204159188992: Issue 1992 - createNightlies.py incorrectly determines repository name if repository path ends with… (Closed)
Patch Set: Created Feb. 12, 2015, 3:01 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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-2015 Eyeo GmbH 4 # Copyright (C) 2006-2015 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 parser = SafeConfigParser() 211 parser = SafeConfigParser()
212 parser.readfp(StringIO(result)) 212 parser.readfp(StringIO(result))
213 213
214 return parser 214 return parser
215 215
216 @property 216 @property
217 def basename(self): 217 def basename(self):
218 metadata = self.readMetadata() 218 metadata = self.readMetadata()
219 if metadata: 219 if metadata:
220 return metadata.get('general', 'basename') 220 return metadata.get('general', 'basename')
221 return os.path.basename(self.repository) 221 return os.path.basename(self.repository) or os.path.basename(os.path.dirname (self.repository))
Sebastian Noack 2015/02/13 10:47:15 How about using normpath? os.path.basename(os.pat
Wladimir Palant 2015/02/13 16:45:10 os.path.dirname() also removes an arbitrary number
222 222
223 def getDownloads(self): 223 def getDownloads(self):
224 prefix = self.basename + '-' 224 prefix = self.basename + '-'
225 command = ['hg', 'locate', '-R', self.downloadsRepo, '-r', 'default'] 225 command = ['hg', 'locate', '-R', self.downloadsRepo, '-r', 'default']
226 226
227 for filename in subprocess.check_output(command).splitlines(): 227 for filename in subprocess.check_output(command).splitlines():
228 if filename.startswith(prefix) and filename.endswith(self.packageSuffix): 228 if filename.startswith(prefix) and filename.endswith(self.packageSuffix):
229 yield (filename, filename[len(prefix):len(filename) - len(self.packageSu ffix)]) 229 yield (filename, filename[len(prefix):len(filename) - len(self.packageSu ffix)])
230 230
231 @staticmethod 231 @staticmethod
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 if not extensions: 444 if not extensions:
445 return 445 return
446 446
447 updates = {} 447 updates = {}
448 for extension in extensions: 448 for extension in extensions:
449 updates[extension['basename']] = { 449 updates[extension['basename']] = {
450 "url": extension['updateURL'], 450 "url": extension['updateURL'],
451 "version": extension['version'] 451 "version": extension['version']
452 } 452 }
453 writeLibabpUpdateManifest(path, updates) 453 writeLibabpUpdateManifest(path, updates)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld