Skip to content

Commit 3fab261

Browse files
committed
Fix path filtering on Windows
1 parent b134d97 commit 3fab261

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

sphinx_autobuild/__main__.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,14 @@ def main(argv=()):
5050
)
5151

5252
watch_dirs = [src_dir] + args.additional_watched_dirs
53-
ignore_dirs = args.ignore + [out_dir, args.warnings_file, args.doctree_dir]
54-
ignore_handler = IgnoreFilter(
55-
[Path(p).as_posix() for p in ignore_dirs if p],
56-
args.re_ignore,
57-
)
53+
ignore_dirs = [
54+
*args.ignore,
55+
out_dir,
56+
args.warnings_file,
57+
args.doctree_dir,
58+
]
59+
ignore_dirs = list(filter(None, ignore_dirs))
60+
ignore_handler = IgnoreFilter(ignore_dirs, args.re_ignore)
5861
app = _create_app(watch_dirs, ignore_handler, builder, out_dir, url_host)
5962

6063
if not args.no_initial_build:

sphinx_autobuild/filter.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
import fnmatch
44
import re
5+
from pathlib import Path
56

67

78
class IgnoreFilter:
89
def __init__(self, regular, regex_based):
910
"""Prepare the function that determines whether a path should be ignored."""
10-
self.regular_patterns = [*dict.fromkeys(regular)]
11+
normalised_paths = [Path(p).resolve().as_posix() for p in regular]
12+
self.regular_patterns = list(dict.fromkeys(normalised_paths))
1113
self.regex_based_patterns = [*map(re.compile, dict.fromkeys(regex_based))]
1214

1315
def __repr__(self):
@@ -18,6 +20,7 @@ def __repr__(self):
1820

1921
def __call__(self, path):
2022
"""Determine if 'path' should be ignored."""
23+
path = Path(path).resolve().as_posix()
2124
# Any regular pattern matches.
2225
for pattern in self.regular_patterns:
2326
# separators are normalised before creating the IgnoreFilter

0 commit comments

Comments
 (0)