summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--setuptools/command/easy_install.py4
-rw-r--r--setuptools/package_index.py2
2 files changed, 4 insertions, 2 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index 3aed8caa..6da39e73 100644
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -922,7 +922,9 @@ class easy_install(Command):
ensure_directory(destination)
dist = self.egg_distribution(egg_path)
- if not os.path.samefile(egg_path, destination):
+ if not (
+ os.path.exists(destination) and os.path.samefile(egg_path, destination)
+ ):
if os.path.isdir(destination) and not os.path.islink(destination):
dir_util.remove_tree(destination, dry_run=self.dry_run)
elif os.path.exists(destination):
diff --git a/setuptools/package_index.py b/setuptools/package_index.py
index 4b127f8c..14881d29 100644
--- a/setuptools/package_index.py
+++ b/setuptools/package_index.py
@@ -680,7 +680,7 @@ class PackageIndex(Environment):
# Make sure the file has been downloaded to the temp dir.
if os.path.dirname(filename) != tmpdir:
dst = os.path.join(tmpdir, basename)
- if not os.path.samefile(filename, dst):
+ if not (os.path.exists(dst) and os.path.samefile(filename, dst)):
shutil.copy2(filename, dst)
filename = dst