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