# HG changeset patch # User Jeff Hammel # Date 1330048145 28800 # Node ID 562230cc2e86fd729f14fa535aa9abfa40447658 # Parent c1181e9c9ca2513621473cc169bfe9e3f629e8be now the package class should at least extracts things. it doesnt actually do anything useful diff -r c1181e9c9ca2 -r 562230cc2e86 paint/package.py --- a/paint/package.py Thu Feb 23 17:45:47 2012 -0800 +++ b/paint/package.py Thu Feb 23 17:49:05 2012 -0800 @@ -3,6 +3,7 @@ """ import os +import shutil import tarfile import tempfile import urllib2 @@ -52,10 +53,19 @@ # TODO: should handle zipfile additionally at least # Ideally, this would be pluggable, etc assert tarfile.is_tarfile(archive), "%s is not an archive" % self.src - tarfile.TarFile.open(archive) + tf = tarfile.TarFile.open(archive) + self._tmppath = tempfile.mkdtemp() + tf.extractall(path=self._tmppath) def is_archive(self, path): """returns if the filesystem path is an archive""" # TODO: should handle zipfile additionally at least # Ideally, this would be pluggable, etc return tarfile.is_tarfile(path) + + def cleanup(self): + if self._tmppath: + shutil.rmtree(self._tmppath) + self._tmppath = None + + __del__ = cleanup