Mercurial > hg > PaInt
changeset 35:e8d73f9e99fb
extension checking
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Fri, 30 Mar 2012 14:24:20 -0700 |
parents | acb2f4896291 |
children | f59da9e6be37 |
files | paint/package.py |
diffstat | 1 files changed, 14 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/paint/package.py Fri Mar 30 14:18:09 2012 -0700 +++ b/paint/package.py Fri Mar 30 14:24:20 2012 -0700 @@ -184,10 +184,19 @@ return dependencies def extension(self): - """filename extension""" - raise NotImplementedError("TODO") + """filename extension of the package""" + + package = self.package() - def repackage(self, destination=None): + # determine the extension (XXX hacky) + extensions = ('.tar.gz', '.zip', '.tar.bz2') + for ext in extensions: + if package.endsiwth(ext): + return ext + + raise Exception("Extension %s not found: %s" % (extensions, package)) + + def package(self, destination=None): """ repackage the package to ensure its actually in the right form and return the path to the destination @@ -247,6 +256,7 @@ # full path src = os.path.join(tempdir, package) + # make a package of the thing package = Package(src) # # get destination dirname, filename @@ -282,7 +292,7 @@ if sdist.filename.endswith(ext): break else: - raise Exception("Extension %s not found: %s" % (extensions, sdist.filename)) + # get the filename destination filename = '%s-%s%s' % (info['name'], ext)