From: Mathieu Bridon Date: Fri, 17 Aug 2018 15:33:02 +0000 (-0600) Subject: python: Help Python 2 print the line X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f9415d760af0bfd00b579c96e5ac866db43e38fe;p=mesa.git python: Help Python 2 print the line Reviewed-by: Jose Fonseca --- diff --git a/src/util/xmlpool/gen_xmlpool.py b/src/util/xmlpool/gen_xmlpool.py index 327709c7f8d..64e631f74c4 100644 --- a/src/util/xmlpool/gen_xmlpool.py +++ b/src/util/xmlpool/gen_xmlpool.py @@ -218,6 +218,11 @@ for line in template: assert len(descMatches) == 0 descMatches = [matchDESC_BEGIN] else: + # In Python 2, stdout expects encoded byte strings, or else it will + # encode them with the ascii 'codec' + if sys.version_info.major == 2: + line = line.encode('utf-8') + print(line, end='') template.close()