Removed portability.py, using from __future__ import print_function instead. This means only Python 2.6 and later is supported in 2.x
diff --git a/examples/func_calls.py b/examples/func_calls.py
index eaa3a67..4789688 100644
--- a/examples/func_calls.py
+++ b/examples/func_calls.py
@@ -4,9 +4,10 @@
# Using pycparser for printing out all the calls of some function
# in a C file.
#
-# Copyright (C) 2008, Eli Bendersky
+# Copyright (C) 2008-2011, Eli Bendersky
# License: LGPL
#-----------------------------------------------------------------
+from __future__ import print_function
import sys
# This is not required if you've installed pycparser into
@@ -15,7 +16,6 @@
sys.path.insert(0, '..')
from pycparser import c_parser, c_ast, parse_file
-from pycparser.portability import printme
# A visitor with some state information (the funcname it's
@@ -27,7 +27,7 @@
def visit_FuncCall(self, node):
if node.name.name == self.funcname:
- printme('%s called at %s\n' % (
+ print('%s called at %s' % (
self.funcname, node.name.coord))
@@ -39,7 +39,7 @@
if __name__ == "__main__":
if len(sys.argv) > 2:
- filename = sys.argv[1]
+ filename = sys.argv[1]
func = sys.argv[2]
else:
filename = 'c_files/hash.c'
diff --git a/examples/func_defs.py b/examples/func_defs.py
index fa15b38..1fd1191 100644
--- a/examples/func_defs.py
+++ b/examples/func_defs.py
@@ -7,9 +7,10 @@
# This is a simple example of traversing the AST generated by
# pycparser.
#
-# Copyright (C) 2008-2009, Eli Bendersky
+# Copyright (C) 2008-2011, Eli Bendersky
# License: LGPL
#-----------------------------------------------------------------
+from __future__ import print_function
import sys
# This is not required if you've installed pycparser into
@@ -18,7 +19,6 @@
sys.path.insert(0, '..')
from pycparser import c_parser, c_ast, parse_file
-from pycparser.portability import printme
# A simple visitor for FuncDef nodes that prints the names and
@@ -26,7 +26,7 @@
#
class FuncDefVisitor(c_ast.NodeVisitor):
def visit_FuncDef(self, node):
- printme('%s at %s\n' % (node.decl.name, node.decl.coord))
+ print('%s at %s' % (node.decl.name, node.decl.coord))
def show_func_defs(filename):