diff options
| author | rsiemens <ryanjsiemens@gmail.com> | 2019-01-27 11:35:17 -0800 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2019-01-28 18:23:41 -0500 |
| commit | a168e5616c85dfd658f20ffbb69a3872c2029dd3 (patch) | |
| tree | 30cc9fa848f7105633097eeda4d1dca8a3c45fa3 /django | |
| parent | bc9f0b32039325e96683e0e4a3ea84428a336c8d (diff) | |
Fixed #29973 -- Added compilemessages --ignore option.
Diffstat (limited to 'django')
| -rw-r--r-- | django/core/management/commands/compilemessages.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/django/core/management/commands/compilemessages.py b/django/core/management/commands/compilemessages.py index ba800d269e..00ab2db6fc 100644 --- a/django/core/management/commands/compilemessages.py +++ b/django/core/management/commands/compilemessages.py @@ -4,7 +4,9 @@ import glob import os from django.core.management.base import BaseCommand, CommandError -from django.core.management.utils import find_command, popen_wrapper +from django.core.management.utils import ( + find_command, is_ignored_path, popen_wrapper, +) def has_bom(fn): @@ -46,10 +48,17 @@ class Command(BaseCommand): '--use-fuzzy', '-f', dest='fuzzy', action='store_true', help='Use fuzzy translations.', ) + parser.add_argument( + '--ignore', '-i', action='append', dest='ignore_patterns', + default=[], metavar='PATTERN', + help='Ignore directories matching this glob-style pattern. ' + 'Use multiple times to ignore more.', + ) def handle(self, **options): locale = options['locale'] exclude = options['exclude'] + ignore_patterns = set(options['ignore_patterns']) self.verbosity = options['verbosity'] if options['fuzzy']: self.program_options = self.program_options + ['-f'] @@ -66,7 +75,9 @@ class Command(BaseCommand): # Walk entire tree, looking for locale directories for dirpath, dirnames, filenames in os.walk('.', topdown=True): for dirname in dirnames: - if dirname == 'locale': + if is_ignored_path(os.path.normpath(os.path.join(dirpath, dirname)), ignore_patterns): + dirnames.remove(dirname) + elif dirname == 'locale': basedirs.append(os.path.join(dirpath, dirname)) # Gather existing directories. |
