From 3b0b05db5057daa1850e55824b43fdefe0d090d6 Mon Sep 17 00:00:00 2001 From: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Date: Mon, 15 Feb 2021 03:04:42 -0800 Subject: [PATCH] Use relative paths when matching exclude (#10078) Co-authored-by: hauntsaninja <> --- mypy/modulefinder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mypy/modulefinder.py b/mypy/modulefinder.py index 2c708b8f802d..82d090702cfc 100644 --- a/mypy/modulefinder.py +++ b/mypy/modulefinder.py @@ -413,7 +413,7 @@ def find_modules_recursive(self, module: str) -> List[BuildSource]: def matches_exclude(subpath: str, exclude: str, fscache: FileSystemCache, verbose: bool) -> bool: if not exclude: return False - subpath_str = os.path.abspath(subpath).replace(os.sep, "/") + subpath_str = os.path.relpath(subpath).replace(os.sep, "/") if fscache.isdir(subpath): subpath_str += "/" if re.search(exclude, subpath_str):