diff options
Diffstat (limited to 'setuptools/command/easy_install.py')
| -rwxr-xr-x | setuptools/command/easy_install.py | 22 |
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: |
