Skip to content

Commit

Permalink
[1.7.x] Fixed #23298 -- Made makemessages actually ignore specified d…
Browse files Browse the repository at this point in the history
…irs on Windows.

This was detected by two failures in the i18n.test_extraction of our
test suite.

Refs #20422, refs #22336

Backport of b4dce7c from master
  • Loading branch information
Ramiro Morales authored and timgraham committed Aug 18, 2014
1 parent d818e02 commit 126606c
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions django/core/management/commands/makemessages.py
Expand Up @@ -347,8 +347,17 @@ def is_ignored(path, ignore_patterns):
fnmatch.fnmatchcase(path, pattern)) fnmatch.fnmatchcase(path, pattern))
return any(ignore(pattern) for pattern in ignore_patterns) return any(ignore(pattern) for pattern in ignore_patterns)


dir_suffix = '%s*' % os.sep ignore_patterns = [os.path.normcase(p) for p in self.ignore_patterns]
norm_patterns = [p[:-len(dir_suffix)] if p.endswith(dir_suffix) else p for p in self.ignore_patterns] dir_suffixes = {'%s*' % path_sep for path_sep in {'/', os.sep}}
norm_patterns = []
for p in ignore_patterns:
for dir_suffix in dir_suffixes:
if p.endswith(dir_suffix):
norm_patterns.append(p[:-len(dir_suffix)])
break
else:
norm_patterns.append(p)

all_files = [] all_files = []
for dirpath, dirnames, filenames in os.walk(force_text(root), topdown=True, followlinks=self.symlinks): for dirpath, dirnames, filenames in os.walk(force_text(root), topdown=True, followlinks=self.symlinks):
for dirname in dirnames[:]: for dirname in dirnames[:]:
Expand Down

0 comments on commit 126606c

Please sign in to comment.