aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPJ Eby <distutils-sig@python.org>2006-09-29 19:26:55 +0000
committerPJ Eby <distutils-sig@python.org>2006-09-29 19:26:55 +0000
commitc82e1669f238c57b80198cafee2039ee5de1310b (patch)
tree4e66077d61fa477899b44c83d518b2f3bbcf5076
parent07a18df5a16b6df50102a0e931d7c4c91b186b48 (diff)
downloadexternal_python_setuptools-c82e1669f238c57b80198cafee2039ee5de1310b.tar.gz
external_python_setuptools-c82e1669f238c57b80198cafee2039ee5de1310b.tar.bz2
external_python_setuptools-c82e1669f238c57b80198cafee2039ee5de1310b.zip
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) --HG-- branch : setuptools-0.6 extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4052047
-rwxr-xr-xsetuptools.txt4
-rwxr-xr-xsetuptools/command/easy_install.py47
2 files changed, 48 insertions, 3 deletions
diff --git a/setuptools.txt b/setuptools.txt
index 68588d7f..dae4e03d 100755
--- a/setuptools.txt
+++ b/setuptools.txt
@@ -2612,6 +2612,10 @@ Release Notes/Change History
* 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
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index 29558d71..88655610 100755
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -1393,9 +1393,19 @@ class PthDistributions(Environment):
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):
@@ -1420,6 +1430,9 @@ 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)
@@ -1452,6 +1465,15 @@ def is_python(text, filename='<string>'):
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.
"""
@@ -1474,6 +1496,25 @@ def is_python_script(script_text, filename):
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())