[Python-checkins] r52046 - sandbox/trunk/setuptools/setuptools/command/easy_install.py
phillip.eby
python-checkins at python.org
Fri Sep 29 21:24:10 CEST 2006
Author: phillip.eby
Date: Fri Sep 29 21:24:10 2006
New Revision: 52046
Modified:
sandbox/trunk/setuptools/setuptools/command/easy_install.py
Log:
Use cross-platform relative paths in .pth if target is anywhere inside the
.pth file's directory.
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 Fri Sep 29 21:24:10 2006
@@ -1393,9 +1393,19 @@
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 @@
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 @@
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 @@
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())
More information about the Python-checkins
mailing list