diff options
Diffstat (limited to 'third_party/python/setuptools/setuptools/py312compat.py')
-rw-r--r-- | third_party/python/setuptools/setuptools/py312compat.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/third_party/python/setuptools/setuptools/py312compat.py b/third_party/python/setuptools/setuptools/py312compat.py new file mode 100644 index 0000000000..28175b1f75 --- /dev/null +++ b/third_party/python/setuptools/setuptools/py312compat.py @@ -0,0 +1,12 @@ +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): + return onexc(fn, path, excinfo[1]) + + return shutil.rmtree(path, ignore_errors, onerror=_handler) |