# HG changeset patch # User Jeff Hammel # Date 1333142660 25200 # Node ID e8d73f9e99fba6eb208de1544dc03a1166b7ad13 # Parent acb2f4896291097b10f5e68821343a31b63dfa1e extension checking diff -r acb2f4896291 -r e8d73f9e99fb paint/package.py --- 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)