summaryrefslogtreecommitdiff
path: root/setuptools/command/easy_install.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2022-02-27 15:33:45 -0500
committerGitHub <noreply@github.com>2022-02-27 15:33:45 -0500
commit6625540cfc30a582017af3a15cab9d4b71953c73 (patch)
tree9aa1eba30f4e1cdc04f3ad27949c472e75107671 /setuptools/command/easy_install.py
parenteced6d5e3d39c9d05a46a3dadb08d806b37ff6f4 (diff)
parent597ff8774e505803a565d9bebde2f8a48519b033 (diff)
downloadpython-setuptools-git-6625540cfc30a582017af3a15cab9d4b71953c73.tar.gz
Merge pull request #3138 from abravalheri/fix-samefile-problems
Check for file existence before using `samefile`
Diffstat (limited to 'setuptools/command/easy_install.py')
-rw-r--r--setuptools/command/easy_install.py4
1 files changed, 3 insertions, 1 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):