From 51998dffe7ef18d314daf23e8e2ef1e2c0891d32 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Wed, 22 May 2013 18:21:33 +0200 Subject: [PATCH] Removed check for 0.15 version of gettext tools gettext 0.15 has been released in July 2006. --- .../core/management/commands/makemessages.py | 12 ---------- tests/i18n/commands/tests.py | 24 ------------------- tests/i18n/tests.py | 6 ++--- 3 files changed, 3 insertions(+), 39 deletions(-) delete mode 100644 tests/i18n/commands/tests.py diff --git a/django/core/management/commands/makemessages.py b/django/core/management/commands/makemessages.py index e693e17400..060def5d5a 100644 --- a/django/core/management/commands/makemessages.py +++ b/django/core/management/commands/makemessages.py @@ -250,18 +250,6 @@ class Command(NoArgsCommand): "if you want to enable i18n for your project or application.") check_programs('xgettext') - # We require gettext version 0.15 or newer. - output, errors, status = popen_wrapper(['xgettext', '--version']) - if status != STATUS_OK: - raise CommandError("Error running xgettext. Note that Django " - "internationalization requires GNU gettext 0.15 or newer.") - match = re.search(r'(?P\d+)\.(?P\d+)', output) - if match: - xversion = (int(match.group('major')), int(match.group('minor'))) - if xversion < (0, 15): - raise CommandError("Django internationalization requires GNU " - "gettext 0.15 or newer. You are using version %s, please " - "upgrade your gettext toolset." % match.group()) potfile = self.build_pot_file(localedir) diff --git a/tests/i18n/commands/tests.py b/tests/i18n/commands/tests.py deleted file mode 100644 index f9e3c20fff..0000000000 --- a/tests/i18n/commands/tests.py +++ /dev/null @@ -1,24 +0,0 @@ -import os -import re -from subprocess import Popen, PIPE - -from django.core.management.utils import find_command - -can_run_extraction_tests = False -can_run_compilation_tests = False - -# checks if it can find xgettext on the PATH and -# imports the extraction tests if yes -xgettext_cmd = find_command('xgettext') -if xgettext_cmd: - p = Popen('%s --version' % xgettext_cmd, shell=True, stdout=PIPE, stderr=PIPE, close_fds=os.name != 'nt', universal_newlines=True) - output = p.communicate()[0] - match = re.search(r'(?P\d+)\.(?P\d+)', output) - if match: - xversion = (int(match.group('major')), int(match.group('minor'))) - if xversion >= (0, 15): - can_run_extraction_tests = True - del p - -if find_command('msgfmt'): - can_run_compilation_tests = True diff --git a/tests/i18n/tests.py b/tests/i18n/tests.py index 9f1e366c9f..777b9c4f75 100644 --- a/tests/i18n/tests.py +++ b/tests/i18n/tests.py @@ -8,6 +8,7 @@ import pickle from threading import local from django.conf import settings +from django.core.management.utils import find_command from django.template import Template, Context from django.template.base import TemplateSyntaxError from django.test import TestCase, RequestFactory @@ -33,14 +34,13 @@ from django.utils.translation import (activate, deactivate, npgettext, npgettext_lazy, check_for_language) -from .commands.tests import can_run_extraction_tests, can_run_compilation_tests -if can_run_extraction_tests: +if find_command('xgettext'): from .commands.extraction import (ExtractorTests, BasicExtractorTests, JavascriptExtractorTests, IgnoredExtractorTests, SymlinkExtractorTests, CopyPluralFormsExtractorTests, NoWrapExtractorTests, NoLocationExtractorTests, KeepPotFileExtractorTests, MultipleLocaleExtractionTests) -if can_run_compilation_tests: +if find_command('msgfmt'): from .commands.compilation import (PoFileTests, PoFileContentsTests, PercentRenderingTests, MultipleLocaleCompilationTests, CompilationErrorHandling)