diff options
author | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2012-02-28 14:18:53 +0000 |
---|---|---|
committer | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2012-02-28 14:18:53 +0000 |
commit | 01dabc7668702c6930b90b2136998cb12e1dc1fd (patch) | |
tree | 921494afe02b28e84b87183d2e473b09591c7f7e /morphlib/tempdir.py | |
parent | dadb4f295c51e3fbb29886cccab5a6beceabe60b (diff) | |
download | morph-01dabc7668702c6930b90b2136998cb12e1dc1fd.tar.gz |
Use Tempdir.remove instead of rm, and drop unused Tempdir.clear
If the remove method is insufficient (because it gets run as non-root,
but some of the stuff needs root to remove them), then we need to fix
the method, not replace it with other things.
The Tempdir.clear method was not used anywhere, so YAGNI and removed it.
Diffstat (limited to 'morphlib/tempdir.py')
-rw-r--r-- | morphlib/tempdir.py | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/morphlib/tempdir.py b/morphlib/tempdir.py index 9780b685..6377fdbc 100644 --- a/morphlib/tempdir.py +++ b/morphlib/tempdir.py @@ -34,16 +34,6 @@ class Tempdir(object): shutil.rmtree(self.dirname) self.dirname = None - def clear(self): - '''Clear temporary directory of everything.''' - logging.debug('Removing contents of %s' % self.dirname) - for x in os.listdir(self.dirname): - filename = self.join(x) - if os.path.isdir(filename): - shutil.rmtree(filename) - else: - os.remove(filename) - def join(self, relative): '''Return full path to file in temporary directory. |