Skip to content

Commit

Permalink
Fix path issues on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed Jan 30, 2024
1 parent 1ea900b commit ebf9fc4
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions sphinx_autobuild/ignore.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,17 @@
import re


def get_ignore(regular, regex_based):
def get_ignore(regular_patterns, regex_based):
"""Prepare the function that determines whether a path should be ignored."""
regular_patterns = regular
regex_based_patterns = [re.compile(r) for r in regex_based]
regex_based_patterns = list(map(re.compile, regex_based))

def ignore(path):
"""Determine if path should be ignored."""
# Any regular pattern matches.
for pattern in regular_patterns:
if fnmatch.fnmatch(path, pattern):
if path.startswith((pattern + os.sep, pattern + '/')):
return True
if path.startswith(pattern + os.sep):
if fnmatch.fnmatch(path, pattern):
return True

# Any regular expression matches.
Expand Down

0 comments on commit ebf9fc4

Please sign in to comment.