[gobject-introspection: 1/3] dumper: fix for Python 3



commit 953c9666ac807de2b9f6222b8d399a2c5e45e522
Author: Christoph Reiter <reiter christoph gmail com>
Date:   Mon Jun 18 09:25:01 2018 +0200

    dumper: fix for Python 3
    
    The MSYS2 only code wasn't ported to Python 3 and failed with a TypeError

 giscanner/dumper.py | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/giscanner/dumper.py b/giscanner/dumper.py
index 8d255bfc..06737188 100644
--- a/giscanner/dumper.py
+++ b/giscanner/dumper.py
@@ -287,6 +287,8 @@ class DumpCompiler(object):
             with os.fdopen(tf, 'wb') as f:
                 shellcontents = ' '.join([x.replace('\\', '/') for x in args])
                 fcontents = '#!/bin/sh\nunset PWD\n{}\n'.format(shellcontents)
+                if not isinstance(fcontents, bytes):
+                    fcontents = fcontents.encode('utf-8')
                 f.write(fcontents)
             shell = utils.which(shell)
             args = [shell, tf_name.replace('\\', '/')]


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]