summaryrefslogtreecommitdiff
path: root/giscanner/sourcescanner.py
diff options
context:
space:
mode:
authorDamien Grassart <damien@grassart.com>2015-10-17 20:39:12 +0200
committerColin Walters <walters@verbum.org>2015-10-19 17:59:30 -0400
commit5341da3520ef513e5a7c49e2d8737bb3f2341a3d (patch)
tree7dd0053b9bd38c982cbce4b01891cf5af93dee3f /giscanner/sourcescanner.py
parentcb956f565785835a6621ca8b89634fe58f59feaf (diff)
downloadgobject-introspection-5341da3520ef513e5a7c49e2d8737bb3f2341a3d.tar.gz
giscanner: Fix python2/3 compatibility
This allows building in both Python 2 and 3 by fixing a few text/binary ambiguities and using "as" in an except clause. https://bugzilla.gnome.org/show_bug.cgi?id=756763
Diffstat (limited to 'giscanner/sourcescanner.py')
-rw-r--r--giscanner/sourcescanner.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/giscanner/sourcescanner.py b/giscanner/sourcescanner.py
index 9a591e1c..049ae162 100644
--- a/giscanner/sourcescanner.py
+++ b/giscanner/sourcescanner.py
@@ -314,10 +314,10 @@ class SourceScanner(object):
def _write_preprocess_src(self, fp, defines, undefs, filenames):
# Write to the temp file for feeding into the preprocessor
for define in defines:
- fp.write('#ifndef %s\n' % (define, ))
- fp.write('# define %s\n' % (define, ))
- fp.write('#endif\n')
+ fp.write(('#ifndef %s\n' % (define, )).encode())
+ fp.write(('# define %s\n' % (define, )).encode())
+ fp.write('#endif\n'.encode())
for undef in undefs:
- fp.write('#undef %s\n' % (undef, ))
+ fp.write(('#undef %s\n' % (undef, )).encode())
for filename in filenames:
- fp.write('#include <%s>\n' % (filename, ))
+ fp.write(('#include <%s>\n' % (filename, )).encode())