summaryrefslogtreecommitdiff
path: root/setuptools/command/easy_install.py
diff options
context:
space:
mode:
authorPJ Eby <distutils-sig@python.org>2005-08-23 13:24:42 +0000
committerPJ Eby <distutils-sig@python.org>2005-08-23 13:24:42 +0000
commitb2382a4ed6703da09393343974c87ce0f4ce6670 (patch)
treed3b01794e20a207e35d4ae8f079d02f3b7786b75 /setuptools/command/easy_install.py
parentb577c94170b64436919bea8e002c64623d0a9644 (diff)
downloadpython-setuptools-git-b2382a4ed6703da09393343974c87ce0f4ce6670.tar.gz
Simplify non-root install process and improve Mac OS docs for it. Support
.pth files and legacy packages possibly being symlinks, and ensure that overwrites don't follow the symlink. --HG-- branch : setuptools extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4041229
Diffstat (limited to 'setuptools/command/easy_install.py')
-rwxr-xr-xsetuptools/command/easy_install.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index 3f754af6..db865e80 100755
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -104,8 +104,10 @@ class easy_install(Command):
for filename in blockers:
log.info("Deleting %s", filename)
if not self.dry_run:
- if os.path.isdir(filename):
- shutil.rmtree(filename)
+ if hasattr(os.path,'islink') and os.path.islink(filename):
+ os.unlink(filename)
+ elif os.path.isdir(filename):
+ shutil.rmtree(filename)
else:
os.unlink(filename)
@@ -119,8 +121,6 @@ class easy_install(Command):
-
-
def finalize_options(self):
# If a non-default installation directory was specified, default the
# script directory to match it.
@@ -846,7 +846,9 @@ See the setuptools documentation for the "develop" command for more info.
if dist.key=='setuptools':
# Ensure that setuptools itself never becomes unavailable!
# XXX should this check for latest version?
- f = open(os.path.join(self.install_dir,'setuptools.pth'), 'wt')
+ filename = os.path.join(self.install_dir,'setuptools.pth')
+ unlink_if_symlink(filename)
+ f = open(filename, 'wt')
f.write(dist.location+'\n')
f.close()
@@ -857,8 +859,6 @@ See the setuptools documentation for the "develop" command for more info.
return dst # only unpack-and-compile skips files for dry run
-
-
def unpack_and_compile(self, egg_path, destination):
to_compile = []
@@ -1017,9 +1017,9 @@ def extract_wininst_cfg(dist_filename):
f.close()
-
-
-
+def unlink_if_symlink(filename):
+ if hasattr(os.path,'islink') and os.path.islink(filename):
+ os.unlink(filename)
@@ -1100,11 +1100,11 @@ class PthDistributions(Environment):
if self.dirty:
log.debug("Saving %s", self.filename)
data = '\n'.join(self.paths+[''])
+ unlink_if_symlink(self.filename)
f = open(self.filename,'wt'); f.write(data); f.close()
self.dirty = False
-
def add(self,dist):
"""Add `dist` to the distribution map"""
if dist.location not in self.paths: