Commits

phillip.eby  committed e2902de

Use cross-platform relative paths in ``easy-install.pth`` when doing
``develop`` and the source directory is a subdirectory of the installation
target directory.
(backport from trunk)

  • Participants
  • Parent commits 3ec88ad
  • Branches setuptools-0.6

Comments (0)

Files changed (2)

File setuptools.txt

 
  * Fix problem with empty revision numbers in Subversion 1.4 ``entries`` files
 
+ * Use cross-platform relative paths in ``easy-install.pth`` when doing
+   ``develop`` and the source directory is a subdirectory of the installation
+   target directory.
+
 0.6c3
  * Fixed breakages caused by Subversion 1.4's new "working copy" format
 

File setuptools/command/easy_install.py

 
 
     def make_relative(self,path):
-        if normalize_path(os.path.dirname(path))==self.basedir:
-            return os.path.join(os.curdir, os.path.basename(path))
-        return path
+        npath, last = os.path.split(normalize_path(path))
+        baselen = len(self.basedir)
+        parts = [last]
+        sep = os.altsep=='/' and '/' or os.sep
+        while len(npath)>=baselen:
+            if npath==self.basedir:
+                parts.append(os.curdir)
+                parts.reverse()
+                return sep.join(parts)
+            npath, last = os.path.split(npath)
+            parts.append(last)
+        else:
+            return path
 
 
 def get_script_header(script_text, executable=sys_executable):
         hdr = "#!%(executable)s%(options)s\n" % locals()
     return hdr
 
+
+
+
 def auto_chmod(func, arg, exc):
     if func is os.remove and os.name=='nt':
         os.chmod(arg, stat.S_IWRITE)
     else:
         return True
 
+
+
+
+
+
+
+
+
+
 def is_python_script(script_text, filename):
     """Is this text, as a whole, a Python script? (as opposed to shell/bat/etc.
     """
     return False    # Not any Python I can recognize
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 def get_script_args(dist, executable=sys_executable):
     """Yield write_script() argument tuples for a distribution's entrypoints"""
     spec = str(dist.as_requirement())