Mesa (master): python: Help Python 2 print the line

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Aug 17 15:37:29 UTC 2018


Module: Mesa
Branch: master
Commit: f9415d760af0bfd00b579c96e5ac866db43e38fe
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f9415d760af0bfd00b579c96e5ac866db43e38fe

Author: Mathieu Bridon <bochecha at daitauha.fr>
Date:   Fri Aug 17 09:33:02 2018 -0600

python: Help Python 2 print the line

Reviewed-by: Jose Fonseca <jfonseca at vmware>

---

 src/util/xmlpool/gen_xmlpool.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/util/xmlpool/gen_xmlpool.py b/src/util/xmlpool/gen_xmlpool.py
index 327709c7f8..64e631f74c 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()




More information about the mesa-commit mailing list