# Path: src/setuptools_scm/utils.py
# def trace(*k) -> None:
#     if DEBUG:
#         print(*k, file=sys.stderr, flush=True)


import os
from .utils import trace
        ).startswith(os.pardir):
            # a symlink to a directory not outside path:
            # we keep it in the result and don't walk its content
            res.append(os.path.join(path, os.path.relpath(dirpath, path)))
            dirnames[:] = []
            continue
        if realdirpath in seen:
            # symlink loop protection
            dirnames[:] = []
            continue
        dirnames[:] = [dn for dn in dirnames if not _link_not_in_scm(dn)]
        for filename in filenames:
            if _link_not_in_scm(filename):
                continue
            # dirpath + filename with symlinks preserved
            fullfilename = os.path.join(dirpath, filename)
            if os.path.normcase(os.path.realpath(fullfilename)) in scm_files:
                res.append(os.path.join(path, os.path.relpath(fullfilename, realpath)))
        seen.add(realdirpath)
    return res


def is_toplevel_acceptable(toplevel):
    """ """
    if toplevel is None:
        return False

    ignored = os.environ.get("SETUPTOOLS_SCM_IGNORE_VCS_ROOTS", "").split(os.pathsep)
    ignored = [os.path.normcase(p) for p in ignored]


# Path: src/setuptools_scm/utils.py
# def trace(*k) -> None:
#     if DEBUG:
#         print(*k, file=sys.stderr, flush=True)


# Path: src/setuptools_scm/file_finder.py
import os
from .utils import trace

        ).startswith(os.pardir):
            # a symlink to a directory not outside path:
            # we keep it in the result and don't walk its content
            res.append(os.path.join(path, os.path.relpath(dirpath, path)))
            dirnames[:] = []
            continue
        if realdirpath in seen:
            # symlink loop protection
            dirnames[:] = []
            continue
        dirnames[:] = [dn for dn in dirnames if not _link_not_in_scm(dn)]
        for filename in filenames:
            if _link_not_in_scm(filename):
                continue
            # dirpath + filename with symlinks preserved
            fullfilename = os.path.join(dirpath, filename)
            if os.path.normcase(os.path.realpath(fullfilename)) in scm_files:
                res.append(os.path.join(path, os.path.relpath(fullfilename, realpath)))
        seen.add(realdirpath)
    return res


def is_toplevel_acceptable(toplevel):
    """ """
    if toplevel is None:
        return False

    ignored = os.environ.get("SETUPTOOLS_SCM_IGNORE_VCS_ROOTS", "").split(os.pathsep)
    ignored = [os.path.normcase(p) for p in ignored]


    trace(toplevel, ignored)