def patch_sysconfig(libpath):
    """This is a hack to make sure that the sysconfig.get_paths()
    returns PEP 582 scheme.
    """
    import functools
    import sysconfig

    bin_prefix = "Scripts" if os.name == "nt" else "bin"
    pep582_base = os.path.dirname(libpath)
    pep582_scheme = {
        "stdlib": "{pep582_base}/lib",
        "platstdlib": "{pep582_base}/lib",
        "purelib": "{pep582_base}/lib",
        "platlib": "{pep582_base}/lib",
        "include": "{pep582_base}/include",
        "scripts": f"{{pep582_base}}/{bin_prefix}",
        "data": "{pep582_base}",
        "prefix": "{pep582_base}",
        "headers": "{pep582_base}/include",
    }

    def patch_pep582(get_paths):
        @functools.wraps(get_paths)
        def wrapper(scheme=None, vars=None, expand=True):
            default_scheme = get_paths.__defaults__[0]
            if not vars and scheme is None:
                scheme = "pep582"
            else:
                scheme = scheme or default_scheme
            return get_paths(scheme, vars, expand)

        return wrapper

    # This returns a global variable, just update it in place.
    sysconfig.get_config_vars()["pep582_base"] = pep582_base
    sysconfig.get_paths = patch_pep582(sysconfig.get_paths)
    sysconfig._INSTALL_SCHEMES["pep582"] = pep582_scheme
This is a hack to make sure that the sysconfig.get_paths()
    returns PEP 582 scheme.
    
src/pdm/pep582/sitecustomize.py