summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYannick Gingras <ygingras@ygingras.net>2011-01-29 16:18:17 -0500
committerYannick Gingras <ygingras@ygingras.net>2011-01-29 16:18:17 -0500
commitc6d607199000a35ea007e7d41cdb765d57c357cb (patch)
tree6cc58b342d30105a6db015fcc36f0d9d2dcf9843
parentba2c20408814bec7594f9c0c9c3c9673fff7ed50 (diff)
downloaddisutils2-c6d607199000a35ea007e7d41cdb765d57c357cb.tar.gz
corrected a leaked temp dir problem
-rw-r--r--distutils2/install.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/distutils2/install.py b/distutils2/install.py
index e7e97d2..09f83cf 100644
--- a/distutils2/install.py
+++ b/distutils2/install.py
@@ -317,13 +317,13 @@ def _update_infos(infos, new_infos):
def remove(project_name, paths=sys.path):
"""Removes a single project from the installation"""
- tmp = tempfile.mkdtemp(prefix=project_name+'-uninstall')
dist = get_distribution(project_name, paths=paths)
if dist is None:
raise DistutilsError('Distribution %s not found' % project_name)
files = dist.get_installed_files(local=True)
rmdirs = []
rmfiles = []
+ tmp = tempfile.mkdtemp(prefix=project_name+'-uninstall')
try:
for file, md5, size in files:
@@ -339,8 +339,8 @@ def remove(project_name, paths=sys.path):
rmfiles.append(file)
if dirname not in rmdirs:
rmdirs.append(dirname)
- except OSError:
- os.rmdir(tmp)
+ finally:
+ shutil.rmtree(tmp)
for file in rmfiles:
os.remove(file)