Commit 51998dff authored by Claude Paroz's avatar Claude Paroz
Browse files

Removed check for 0.15 version of gettext tools

gettext 0.15 has been released in July 2006.
parent dc51ec8b
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -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<major>\d+)\.(?P<minor>\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)

tests/i18n/commands/tests.py

deleted100644 → 0
+0 −24
Original line number Diff line number Diff line
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<major>\d+)\.(?P<minor>\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
+3 −3
Original line number Diff line number Diff line
@@ -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)