summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRamiro Morales <ramiro@rmorales.net>2014-08-15 16:19:04 -0300
committerTim Graham <timograham@gmail.com>2014-08-18 13:00:12 -0400
commit126606c5b8499830cd56cbe632f6af17bc7471ea (patch)
tree9dcb6ee263899f9af0f0d0efe701ac58c27b5982
parentd818e02134ae719108e12b24a7da7416328c2190 (diff)
[1.7.x] Fixed #23298 -- Made makemessages actually ignore specified dirs on Windows.
This was detected by two failures in the i18n.test_extraction of our test suite. Refs #20422, refs #22336 Backport of b4dce7c37a from master
-rw-r--r--django/core/management/commands/makemessages.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/django/core/management/commands/makemessages.py b/django/core/management/commands/makemessages.py
index 11b36aebb2..c3a291bf4f 100644
--- a/django/core/management/commands/makemessages.py
+++ b/django/core/management/commands/makemessages.py
@@ -347,8 +347,17 @@ class Command(NoArgsCommand):
fnmatch.fnmatchcase(path, pattern))
return any(ignore(pattern) for pattern in ignore_patterns)
- dir_suffix = '%s*' % os.sep
- norm_patterns = [p[:-len(dir_suffix)] if p.endswith(dir_suffix) else p for p in self.ignore_patterns]
+ ignore_patterns = [os.path.normcase(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 = []
for dirpath, dirnames, filenames in os.walk(force_text(root), topdown=True, followlinks=self.symlinks):
for dirname in dirnames[:]: