diff options
Diffstat (limited to 'setuptools/_py312compat.py')
-rw-r--r-- | setuptools/_py312compat.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/setuptools/_py312compat.py b/setuptools/_py312compat.py new file mode 100644 index 00000000..a17d5aec --- /dev/null +++ b/setuptools/_py312compat.py @@ -0,0 +1,11 @@ +import sys +import shutil + +def shutil_rmtree(path, ignore_errors=False, onexc=None): + if sys.version_info >= (3, 12): + return shutil.rmtree(path, ignore_errors, onexc=onexc) + + def _handler(fn, path, excinfo): + onexc(fn, path, excinfo[1]) + + return shutil.rmtree(path, ignore_errors, onerror=_handler) |