[Python-checkins] distutils2: corrected a leaked temp dir problem
tarek.ziade
python-checkins at python.org
Sun Jan 30 10:45:09 CET 2011
tarek.ziade pushed c732ac2c3105 to distutils2:
http://hg.python.org/distutils2/rev/c732ac2c3105
changeset: 958:c732ac2c3105
parent: 952:1e23203b0675
user: Yannick Gingras <ygingras at ygingras.net>
date: Sat Jan 29 16:18:17 2011 -0500
summary:
corrected a leaked temp dir problem
files:
distutils2/install.py
diff --git a/distutils2/install.py b/distutils2/install.py
--- a/distutils2/install.py
+++ b/distutils2/install.py
@@ -317,13 +317,13 @@
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 @@
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)
--
Repository URL: http://hg.python.org/distutils2
More information about the Python-checkins
mailing list