From 90dd4afd060fdbdad6b6341488ec76c14c10680a Mon Sep 17 00:00:00 2001 From: Paul Franklin Date: Sun, 4 Oct 2015 19:14:50 -0700 Subject: [PATCH] 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. --- setup.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 14e9b6143..6a491672f 100644 --- a/setup.py +++ b/setup.py @@ -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