build: fix Python 3 unicode issue with waf 1.8.6

Starting with waf 1.8.6 (in Python 3), the hcode variable isn't a
string, but a byte string.

This commit adds the solution proposed in the upstream waf bug report:
https://code.google.com/p/waf/issues/detail?id=1535

It seems a bit overly verbose, but on the other hand, this solution has
the chance of being most correct/compatible.

Fixes #1604.
This commit is contained in:
wm4 2015-02-19 09:40:50 +01:00
parent a34d331841
commit 14b231119d
1 changed files with 7 additions and 1 deletions

View File

@ -33,7 +33,13 @@ def build(ctx):
cls = Task.classes['cprogram']
class cprogram(cls):
run_str = cls.hcode + '${LAST_LINKFLAGS}'
try:
run_str = cls.orig_run_str + '${LAST_LINKFLAGS}'
except AttributeError:
try:
run_str = cls.hcode + '${LAST_LINKFLAGS}'
except TypeError:
run_str = cls.hcode.decode('iso8859-1') + '${LAST_LINKFLAGS}'
cls = Task.classes['macplist']
class macplist(cls):