win32 changes

svn: r21330
This commit is contained in:
Josip Pisoj 2013-02-10 17:37:56 +00:00
parent 5e4b2d3bdc
commit 1500556d99

View File

@ -62,17 +62,27 @@ def intltool_version():
''' '''
Return the version of intltool as a tuple. Return the version of intltool as a tuple.
''' '''
if not sys.platform == 'win32': if sys.platform == 'win32':
cmd = 'intltool-update --version | head -1 | cut -d" " -f3' cmd = ["perl", "-e print qx(intltool-update --version) =~ m/(\d+.\d+.\d+)/;"]
try:
ver, ret = subprocess.Popen(cmd ,stdout=subprocess.PIPE,
stderr=subprocess.PIPE).communicate()
if sys.version_info[0] > 2:
ver = ver.decode("utf-8")
if ver > "":
version_str = ver
else: else:
cmd = "perl -e 'print `intltool-update --version 2>&1` =~ m/(\d+.\d+.\d+)/;'" return (0,0,0)
except:
return (0,0,0)
else:
cmd = 'intltool-update --version | head -1 | cut -d" " -f3'
if sys.version_info[0] < 3: if sys.version_info[0] < 3:
retcode, version_str = commands.getstatusoutput(cmd) retcode, version_str = commands.getstatusoutput(cmd)
else: else:
retcode, version_str = subprocess.getstatusoutput(cmd) retcode, version_str = subprocess.getstatusoutput(cmd)
if retcode != 0: if retcode != 0:
return None return None
else:
return tuple([int(num) for num in version_str.split('.')]) return tuple([int(num) for num in version_str.split('.')])
def substitute_variables(filename_in, filename_out, subst_vars): def substitute_variables(filename_in, filename_out, subst_vars):