comparison paint/package.py @ 35:e8d73f9e99fb

extension checking
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 30 Mar 2012 14:24:20 -0700
parents acb2f4896291
children f59da9e6be37
comparison
equal deleted inserted replaced
34:acb2f4896291 35:e8d73f9e99fb
182 dependencies[dep] = link 182 dependencies[dep] = link
183 183
184 return dependencies 184 return dependencies
185 185
186 def extension(self): 186 def extension(self):
187 """filename extension""" 187 """filename extension of the package"""
188 raise NotImplementedError("TODO") 188
189 189 package = self.package()
190 def repackage(self, destination=None): 190
191 # determine the extension (XXX hacky)
192 extensions = ('.tar.gz', '.zip', '.tar.bz2')
193 for ext in extensions:
194 if package.endsiwth(ext):
195 return ext
196
197 raise Exception("Extension %s not found: %s" % (extensions, package))
198
199 def package(self, destination=None):
191 """ 200 """
192 repackage the package to ensure its actually in the right form 201 repackage the package to ensure its actually in the right form
193 and return the path to the destination 202 and return the path to the destination
194 - destination: if given, path to put the build in [TODO] 203 - destination: if given, path to put the build in [TODO]
195 """ 204 """
245 for package in os.listdir(tempdir): 254 for package in os.listdir(tempdir):
246 255
247 # full path 256 # full path
248 src = os.path.join(tempdir, package) 257 src = os.path.join(tempdir, package)
249 258
259 # make a package of the thing
250 package = Package(src) 260 package = Package(src)
251 261
252 # # get destination dirname, filename 262 # # get destination dirname, filename
253 # try: 263 # try:
254 # dirname, filename = pypi.pypi_path(src) 264 # dirname, filename = pypi.pypi_path(src)
280 for ext in extensions: 290 for ext in extensions:
281 import pdb; pdb.set_trace() 291 import pdb; pdb.set_trace()
282 if sdist.filename.endswith(ext): 292 if sdist.filename.endswith(ext):
283 break 293 break
284 else: 294 else:
285 raise Exception("Extension %s not found: %s" % (extensions, sdist.filename)) 295
286 296
287 # get the filename destination 297 # get the filename destination
288 filename = '%s-%s%s' % (info['name'], ext) 298 filename = '%s-%s%s' % (info['name'], ext)
289 return sdist.name, filename 299 return sdist.name, filename