diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2022-02-26 15:30:52 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-26 15:30:52 -0500 |
| commit | eced6d5e3d39c9d05a46a3dadb08d806b37ff6f4 (patch) | |
| tree | 6cf6bc63d83c4ff1af0ed35cf3e21bd66287dc39 /setuptools/command | |
| parent | 5ae9aa41369b8b0c8e1710475988ac0e9e3cf431 (diff) | |
| parent | 66dcd5e54fd8fb1f9413b4fac04e073984ed0713 (diff) | |
| download | python-setuptools-git-eced6d5e3d39c9d05a46a3dadb08d806b37ff6f4.tar.gz | |
Merge pull request #3137 from pypa/feature/samefile-native
Use samefile from stdlib, supported on Windows since Python 3.2.
Diffstat (limited to 'setuptools/command')
| -rw-r--r-- | setuptools/command/easy_install.py | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index 905bc627..3aed8caa 100644 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -70,7 +70,7 @@ from ..extern.jaraco.text import yield_lines warnings.filterwarnings("default", category=pkg_resources.PEP440Warning) __all__ = [ - 'samefile', 'easy_install', 'PthDistributions', 'extract_wininst_cfg', + 'easy_install', 'PthDistributions', 'extract_wininst_cfg', 'get_exe_prefixes', ] @@ -79,22 +79,6 @@ def is_64bit(): return struct.calcsize("P") == 8 -def samefile(p1, p2): - """ - Determine if two paths reference the same file. - - Augments os.path.samefile to work on Windows and - suppresses errors if the path doesn't exist. - """ - both_exist = os.path.exists(p1) and os.path.exists(p2) - use_samefile = hasattr(os.path, 'samefile') and both_exist - if use_samefile: - return os.path.samefile(p1, p2) - norm_p1 = os.path.normpath(os.path.normcase(p1)) - norm_p2 = os.path.normpath(os.path.normcase(p2)) - return norm_p1 == norm_p2 - - def _to_bytes(s): return s.encode('utf8') @@ -938,7 +922,7 @@ class easy_install(Command): ensure_directory(destination) dist = self.egg_distribution(egg_path) - if not samefile(egg_path, destination): + if not 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): |
