Skip to content

Commit

Permalink
Restore Python 3 support for parser
Browse files Browse the repository at this point in the history
  • Loading branch information
pfernique committed Sep 19, 2017
1 parent 161c07f commit 8d66457
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/py/autowig/_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from .plugin import PluginManager
import sys
import platform
import six

from .asg import (DeclarationProxy,
NamespaceProxy,
Expand Down Expand Up @@ -124,6 +125,8 @@ def pre_processing(asg, headers, flags, **kwargs):
warnings.warn('System includes not computed: clang command failed', Warning)
else:
out, err = s.communicate()
if six.PY3:
err = err.decode('ascii', 'ignore')
sysincludes = err.splitlines()
if '#include <...> search starts here:' not in sysincludes or 'End of search list.' not in sysincludes:
warnings.warn('System includes not computed: parsing clang command output failed', Warning)
Expand Down Expand Up @@ -251,7 +254,10 @@ def bootstrap(asg, flags, **kwargs):
headers.append("}")
forbidden.update(set(gray))
header = NamedTemporaryFile(delete=False)
header.write('\n'.join(headers))
if six.PY2:
header.write('\n'.join(headers))
else:
header.write(('\n'.join(headers)).encode())
header.close()
asg = parser(asg, [header.name], flags +["-Wno-unused-value", "-ferror-limit=0"], bootstrapping=True, **kwargs)
os.unlink(header.name)
Expand Down

0 comments on commit 8d66457

Please sign in to comment.