aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/setuptools/py3/setuptools/compat/py311.py
blob: 28175b1f750445011d74e14027745a4b23556a29 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
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)