summaryrefslogtreecommitdiff
path: root/setuptools/command
diff options
context:
space:
mode:
authorAnderson Bravalheri <andersonbravalheri@gmail.com>2022-02-27 18:43:22 +0000
committerAnderson Bravalheri <andersonbravalheri@gmail.com>2022-02-27 18:43:22 +0000
commitfb7b30d64eb1475a0f5692e015ac123834ff6c40 (patch)
treee859911c447e998e12b6948590a97afb52e817d6 /setuptools/command
parenteced6d5e3d39c9d05a46a3dadb08d806b37ff6f4 (diff)
downloadpython-setuptools-git-fb7b30d64eb1475a0f5692e015ac123834ff6c40.tar.gz
Check for file existence before using samefile
Diffstat (limited to 'setuptools/command')
-rw-r--r--setuptools/command/easy_install.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index 3aed8caa..80ff6347 100644
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -922,7 +922,8 @@ class easy_install(Command):
ensure_directory(destination)
dist = self.egg_distribution(egg_path)
- if not os.path.samefile(egg_path, destination):
+ both_exist = os.path.exists(egg_path) and os.path.exists(destination)
+ if not (both_exist 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):