Skip to content

Commit 79b06aa

Browse files
abravalheriAvasam
andauthored
Update setuptools/command/easy_install.py
Co-authored-by: Avasam <samuel.06@hotmail.com>
1 parent 04f6ee9 commit 79b06aa

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

setuptools/command/easy_install.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1791,15 +1791,10 @@ def _first_line_re():
17911791
# Must match shutil._OnExcCallback
17921792
def auto_chmod(func: Callable[..., _T], arg: str, exc: BaseException) -> _T:
17931793
"""shutils onexc callback to automatically call chmod for certain functions."""
1794-
if os.name != 'nt':
1795-
raise OSError(f"Can't call auto_chmod on non-nt os {os.name!r}") from exc
1796-
supported_methods = {os.unlink, os.remove}
1797-
if func not in supported_methods:
1798-
raise ValueError(
1799-
f"Argument func is not one of {[method.__name__ for method in supported_methods]} (got: {func.__name__!r})"
1800-
) from exc
1801-
chmod(arg, stat.S_IWRITE)
1802-
return func(arg)
1794+
if func in [os.unlink, os.remove] and os.name == 'nt':
1795+
chmod(arg, stat.S_IWRITE)
1796+
return func(arg)
1797+
raise exc
18031798

18041799

18051800
def update_dist_caches(dist_path, fix_zipimporter_caches):

0 commit comments

Comments
 (0)