2010-02-16 13:13:23 +01:00
|
|
|
import os
|
2010-02-22 21:25:43 +01:00
|
|
|
import re
|
|
|
|
from subprocess import Popen, PIPE
|
2010-02-16 13:13:23 +01:00
|
|
|
|
2013-02-12 20:50:47 +01:00
|
|
|
from django.core.management.utils import find_command
|
2012-07-20 14:22:00 +02:00
|
|
|
|
2011-10-18 22:35:42 +02:00
|
|
|
can_run_extraction_tests = False
|
|
|
|
can_run_compilation_tests = False
|
|
|
|
|
2010-02-22 00:45:04 +01:00
|
|
|
# checks if it can find xgettext on the PATH and
|
|
|
|
# imports the extraction tests if yes
|
2010-02-22 21:25:43 +01:00
|
|
|
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')))
|
2010-02-22 21:27:58 +01:00
|
|
|
if xversion >= (0, 15):
|
2011-10-18 22:35:42 +02:00
|
|
|
can_run_extraction_tests = True
|
2010-03-29 09:24:45 +02:00
|
|
|
del p
|
2010-10-10 18:38:28 +02:00
|
|
|
|
|
|
|
if find_command('msgfmt'):
|
2011-10-18 22:35:42 +02:00
|
|
|
can_run_compilation_tests = True
|