handle case of no intltool when doing "python3 setup.py build"

I installed my development environment on a different machine
but for some reason didn't install intltool.  But it took me
a while to notice since I normally routinely divert the output
to a file.  So it was crashing but I didn't know.

But when I examined setup.py I saw that was tested for, at least
it was supposed to be tested for.  But on my particular machine
when the test was piped into more commands the whole piped command
was returning a zero status, even though there was no intltool
at all.  So I have added an explicit test for intltool and that
does indeed fail on my machine, without one.
This commit is contained in:
Paul Franklin 2015-10-04 19:14:04 -07:00
parent 05a53a40c9
commit 5fa70824a3

View File

@ -91,10 +91,14 @@ def intltool_version():
except:
return (0,0,0)
else:
cmd = 'intltool-update --version 2> /dev/null | head -1 | cut -d" " -f3'
cmd = 'intltool-update --version 2> /dev/null' # pathological case
retcode, version_str = subprocess.getstatusoutput(cmd)
if retcode != 0:
return None
cmd = 'intltool-update --version 2> /dev/null | head -1 | cut -d" " -f3'
retcode, version_str = subprocess.getstatusoutput(cmd)
if retcode != 0: # unlikely but just barely imaginable, so leave it
return None
return tuple([int(num) for num in version_str.split('.')])
def substitute_variables(filename_in, filename_out, subst_vars):
@ -186,7 +190,8 @@ def build_intl(build_cmd):
'''
Merge translation files into desktop and mime files
'''
if intltool_version() < (0, 25, 0):
i_v = intltool_version()
if i_v is None or i_v < (0, 25, 0):
return
data_files = build_cmd.distribution.data_files
base = build_cmd.build_base