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:
parent
db7255febc
commit
90dd4afd06
9
setup.py
9
setup.py
@ -91,10 +91,14 @@ def intltool_version():
|
|||||||
except:
|
except:
|
||||||
return (0,0,0)
|
return (0,0,0)
|
||||||
else:
|
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)
|
retcode, version_str = subprocess.getstatusoutput(cmd)
|
||||||
if retcode != 0:
|
if retcode != 0:
|
||||||
return None
|
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('.')])
|
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):
|
||||||
@ -186,7 +190,8 @@ def build_intl(build_cmd):
|
|||||||
'''
|
'''
|
||||||
Merge translation files into desktop and mime files
|
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
|
return
|
||||||
data_files = build_cmd.distribution.data_files
|
data_files = build_cmd.distribution.data_files
|
||||||
base = build_cmd.build_base
|
base = build_cmd.build_base
|
||||||
|
Loading…
Reference in New Issue
Block a user