[Python-checkins] distutils2: Automated merge with ssh://bitbucket.org/tarek/distutils2

tarek.ziade python-checkins at python.org
Sun Jan 30 10:45:09 CET 2011


tarek.ziade pushed d031f7444d8b to distutils2:
http://hg.python.org/distutils2/rev/d031f7444d8b
changeset: 960:d031f7444d8b
parent: 955:4b89c997484d
parent: 959:486bb332c45f
user: Yannick Gingras <ygingras at ygingras.net>
date: Sat Jan 29 18:32:36 2011 -0500
summary:
 Automated merge with ssh://bitbucket.org/tarek/distutils2
files:
 
diff --git a/distutils2/install.py b/distutils2/install.py
--- a/distutils2/install.py
+++ b/distutils2/install.py
@@ -130,8 +130,10 @@
 :param dists: distributions to install
 :param path: base path to install distribution in
 """
+ path_is_tmp = False
 if not path:
 path = mkdtemp()
+ path_is_tmp = True
 
 installed_dists, installed_files = [], []
 for d in dists:
@@ -146,6 +148,10 @@
 for d in installed_dists:
 uninstall(d)
 raise e
+ finally:
+ if path_is_tmp:
+ shutil.rmtree(path)
+ 
 return installed_files
 
 
@@ -317,13 +323,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 +345,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

AltStyle によって変換されたページ (->オリジナル) /