Skip to content

Commit

Permalink
Update setuptools/command/easy_install.py
Browse files Browse the repository at this point in the history
Co-authored-by: Avasam <[email protected]>
  • Loading branch information
abravalheri and Avasam authored Aug 27, 2024
1 parent 04f6ee9 commit 79b06aa
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions setuptools/command/easy_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -1791,15 +1791,10 @@ def _first_line_re():
# Must match shutil._OnExcCallback
def auto_chmod(func: Callable[..., _T], arg: str, exc: BaseException) -> _T:
"""shutils onexc callback to automatically call chmod for certain functions."""
if os.name != 'nt':
raise OSError(f"Can't call auto_chmod on non-nt os {os.name!r}") from exc
supported_methods = {os.unlink, os.remove}
if func not in supported_methods:
raise ValueError(
f"Argument func is not one of {[method.__name__ for method in supported_methods]} (got: {func.__name__!r})"
) from exc
chmod(arg, stat.S_IWRITE)
return func(arg)
if func in [os.unlink, os.remove] and os.name == 'nt':
chmod(arg, stat.S_IWRITE)
return func(arg)
raise exc


def update_dist_caches(dist_path, fix_zipimporter_caches):
Expand Down

0 comments on commit 79b06aa

Please sign in to comment.