[Python-checkins] commit of r41382 - in sandbox/trunk/setuptools: . setuptools/command

phillip.eby@python.org phillip.eby at python.org
Thu Nov 3 04:28:45 CET 2005


Author: phillip.eby
Date: Thu Nov  3 04:28:44 2005
New Revision: 41382

Modified:
   sandbox/trunk/setuptools/EasyInstall.txt
   sandbox/trunk/setuptools/setuptools/command/easy_install.py
Log:
Fix some Subversion-related problems reported by John J. Lee:

* Fixed not installing dependencies for some packages fetched via Subversion

* Fixed dependency installation with ``--always-copy`` not using the same
  dependency resolution procedure as other operations.

* Fixed not fully removing temporary directories on Windows, if a Subversion
  checkout left read-only files behind



Modified: sandbox/trunk/setuptools/EasyInstall.txt
==============================================================================
--- sandbox/trunk/setuptools/EasyInstall.txt	(original)
+++ sandbox/trunk/setuptools/EasyInstall.txt	Thu Nov  3 04:28:44 2005
@@ -865,6 +865,15 @@
  * There's no automatic retry for borked Sourceforge mirrors, which can easily
    time out or be missing a file.
 
+0.6a8
+ * Fixed not installing dependencies for some packages fetched via Subversion
+
+ * Fixed dependency installation with ``--always-copy`` not using the same
+   dependency resolution procedure as other operations.
+
+ * Fixed not fully removing temporary directories on Windows, if a Subversion
+   checkout left read-only files behind
+
 0.6a7
  * Fixed not being able to install Windows script wrappers using Python 2.3
 

Modified: sandbox/trunk/setuptools/setuptools/command/easy_install.py
==============================================================================
--- sandbox/trunk/setuptools/setuptools/command/easy_install.py	(original)
+++ sandbox/trunk/setuptools/setuptools/command/easy_install.py	Thu Nov  3 04:28:44 2005
@@ -10,7 +10,7 @@
 __ http://peak.telecommunity.com/DevCenter/EasyInstall
 """
 
-import sys, os.path, zipimport, shutil, tempfile, zipfile, re
+import sys, os.path, zipimport, shutil, tempfile, zipfile, re, stat
 from glob import glob
 from setuptools import Command
 from setuptools.sandbox import run_setup
@@ -318,7 +318,7 @@
 
         finally:
             if os.path.exists(tmpdir):
-                shutil.rmtree(tmpdir)
+                smart_rmtree(tmpdir)
 
 
 
@@ -374,27 +374,22 @@
         self.install_egg_scripts(dist)
         self.installed_projects[dist.key] = dist
         log.warn(self.installation_report(dist, *info))
-
-        if requirement is None:
-            requirement = dist.as_requirement()
-
-        if dist not in requirement:
-            return
-
-        if deps or self.always_copy:
-            log.info("Processing dependencies for %s", requirement)
-        else:
-            return
-
-        if self.always_copy:
-            # Recursively install *all* dependencies
-            for req in dist.requires(requirement.extras):
-                if req.key not in self.installed_projects:
-                    self.easy_install(req)
+        if not deps and not self.always_copy:
             return
+        elif requirement is not None and dist.key != requirement.key:
+            log.warn("Skipping dependencies for %s", dist)
+            return  # XXX this is not the distribution we were looking for
+
+        if requirement is None or dist not in requirement:
+            # if we wound up with a different version, resolve what we've got
+            distreq = dist.as_requirement()
+            requirement = Requirement(
+                distreq.project_name, distreq.specs, requirement.extras
+            )
 
+        log.info("Processing dependencies for %s", requirement)
         try:
-            WorkingSet([]).resolve(
+            distros = WorkingSet([]).resolve(
                 [requirement], self.local_index, self.easy_install
             )
         except DistributionNotFound, e:
@@ -407,6 +402,11 @@
                 % e.args
             )
 
+        if self.always_copy:
+            # Force all the relevant distros to be copied or activated
+            for dist in distros:
+                if dist.key not in self.installed_projects:
+                    self.easy_install(dist.as_requirement())
 
     def should_unzip(self, dist):
         if self.zip_ok is not None:
@@ -824,7 +824,7 @@
 
         args = list(args)
         if self.verbose>2:
-            v = 'v' * self.verbose - 1
+            v = 'v' * (self.verbose - 1)
             args.insert(0,'-'+v)
         elif self.verbose<2:
             args.insert(0,'-q')
@@ -1187,3 +1187,44 @@
 
 
 
+def smart_rmtree(path):
+    """Recursively delete a directory tree."""
+    cmdtuples = []
+    shutil._build_cmdtuple(path, cmdtuples)
+    for func, arg in cmdtuples:
+        try:
+            func(arg)
+        except OSError:
+            if os.name=='nt' and func is not os.rmdir:
+                os.chmod(arg, stat.S_IWRITE)
+                try:
+                    func(arg)
+                    continue
+                except OSError:
+                    pass
+            exc = sys.exc_info()
+            raise exc[0], (exc[1][0], exc[1][1] + ' removing '+arg)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+


More information about the Python-checkins mailing list