[Checkins] SVN: zc.buildout/trunk/src/zc/buildout/easy_install.py Made realpath more robust and added some missing and removed some

Jim Fulton jim at zope.com
Sun Jan 13 15:53:04 EST 2008


Log message for revision 82853:
  Made realpath more robust and added some missing and removed some
  extra uses.
  

Changed:
  U   zc.buildout/trunk/src/zc/buildout/easy_install.py

-=-
Modified: zc.buildout/trunk/src/zc/buildout/easy_install.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/easy_install.py	2008-01-13 20:51:57 UTC (rev 82852)
+++ zc.buildout/trunk/src/zc/buildout/easy_install.py	2008-01-13 20:53:04 UTC (rev 82853)
@@ -28,14 +28,10 @@
 import setuptools.archive_util
 import zc.buildout
 
+_oprp = getattr(os.path, 'realpath', lambda path: path)
 def realpath(path):
-    return path
+    return os.path.normcase(os.path.abspath(_oprp(path)))
 
-try:
-    realpath = os.path.realpath
-except AttributeError:
-    pass
-
 default_index_url = os.environ.get(
     'buildout-testing-index-url',
     'http://pypi.python.org/simple',
@@ -397,7 +393,7 @@
             for dist in best:
                 if (realpath(os.path.dirname(dist.location))
                     ==
-                    realpath(self._download_cache)
+                    self._download_cache
                     ):
                     return dist
 
@@ -406,13 +402,13 @@
 
     def _fetch(self, dist, tmp, download_cache):
         if (download_cache
-            and (os.path.dirname(dist.location) == download_cache)
+            and (realpath(os.path.dirname(dist.location)) == download_cache)
             ):
             return dist
 
         new_location = self._index.download(dist.location, tmp)
         if (download_cache
-            and (new_location == dist.location)
+            and (realpath(new_location) == realpath(dist.location))
             and os.path.isfile(new_location)
             ):
             # setuptools avoids making extra copies, but we want to copy
@@ -701,7 +697,7 @@
     old = Installer._download_cache
     if path != -1:
         if path:
-            path = os.path.abspath(path)
+            path = realpath(path)
         Installer._download_cache = path
     return old
 



More information about the Checkins mailing list