Commit 8ed27a5f authored by Christoph Mallon's avatar Christoph Mallon
Browse files

Use print(x) instead of the deprecated print x.

parent 04b02ece
......@@ -125,7 +125,7 @@ def format_pinned(node):
return "op_pin_state_floats"
if pinned == "exception":
return "op_pin_state_exc_pinned"
print "WARNING: Unknown pinned state %s in format pined" % pinned
print("WARNING: Unknown pinned state %s in format pined" % pinned)
return ""
def format_flags(node):
......@@ -271,7 +271,7 @@ def prepare_nodes(nodes):
def main(argv):
if len(argv) < 3:
print "usage: %s specfile templatefile" % argv[0]
print("usage: %s specfile templatefile" % argv[0])
sys.exit(1)
specfile = argv[1]
......
......@@ -138,7 +138,7 @@ def preprocess_node(node):
def main(argv):
if len(argv) < 3:
print "usage: %s specname(ignored) destdirectory" % argv[0]
print("usage: %s specname(ignored) destdirectory" % argv[0])
sys.exit(1)
specfile = argv[1]
......
......@@ -25,7 +25,7 @@ def rewrite_imports(lines):
def main():
if len(sys.argv) != 2:
print 'error: only argument is path to markupsafe'
print('error: only argument is path to markupsafe')
sys.exit(1)
basedir = os.path.dirname(__file__)
markupdir = sys.argv[1]
......
......@@ -30,33 +30,33 @@ def inout_contains(l, name):
def verify_node(node):
if not hasattr(node, "pinned"):
print "%s: NO PINNED SET" % node.name
print("%s: NO PINNED SET" % node.name)
elif node.pinned not in ["yes", "no", "exception"]:
print "%s: UNKNOWN PINNED MODE: %s" % (node.name, node.pinned)
print("%s: UNKNOWN PINNED MODE: %s" % (node.name, node.pinned))
if not hasattr(node, "flags"):
if not isAbstract(node):
print "WARNING: no flags specified for %s\n" % node.name
print("WARNING: no flags specified for %s\n" % node.name)
elif type(node.flags) != list:
print "ERROR: flags of %s not a list" % node.name
print("ERROR: flags of %s not a list" % node.name)
if hasattr(node, "pinned_init") and not is_dynamic_pinned(node):
print "ERROR: node %s has pinned_init attribute but is not marked as dynamically pinned" % node.name
print("ERROR: node %s has pinned_init attribute but is not marked as dynamically pinned" % node.name)
if hasattr(node, "flags") and "uses_memory" in node.flags:
if not inout_contains(node.ins, "mem"):
print "ERROR: memory op %s needs an input named 'mem'" % node.name
print("ERROR: memory op %s needs an input named 'mem'" % node.name)
if is_fragile(node):
if not is_dynamic_pinned(node):
print "ERROR: fragile node %s must be dynamically pinned" % node.name
print("ERROR: fragile node %s must be dynamically pinned" % node.name)
if not hasattr(node, "throws_init"):
print "ERROR: fragile node %s needs a throws_init attribute" % node.name
print("ERROR: fragile node %s needs a throws_init attribute" % node.name)
if not inout_contains(node.outs, "X_regular"):
print "ERROR: fragile node %s needs an output named 'X_regular'" % node.name
print("ERROR: fragile node %s needs an output named 'X_regular'" % node.name)
if not inout_contains(node.outs, "X_except"):
print "ERROR: fragile node %s needs an output named 'X_except'" % node.name
print("ERROR: fragile node %s needs an output named 'X_except'" % node.name)
else:
if hasattr(node, "throws_init"):
print "ERROR: throws_init only makes sense for fragile nodes"
print("ERROR: throws_init only makes sense for fragile nodes")
def setldefault(node, attr, val):
......@@ -98,9 +98,9 @@ def load_spec(filename):
nodes.sort(key=lambda x: x.name)
module.nodes = nodes
if len(nodes) == 0:
print "Warning: No nodes found in spec file '%s'" % filename
print("Warning: No nodes found in spec file '%s'" % filename)
if not hasattr(module, "name"):
print "Warning: No name specified in file '%s'" % filename
print("Warning: No name specified in file '%s'" % filename)
return module
def trim_docstring(docstring):
......
......@@ -44,7 +44,7 @@ class EmitMysql(EmitBase):
tmpfile_mode = stat.S_IREAD | stat.S_IROTH | stat.S_IWUSR
def execute(self, query, *args):
#print query + " %s\n" % str(tuple(args))
#print(query + " %s\n" % str(tuple(args)))
self.cursor.execute(query, *args);
self.conn.commit()
......@@ -104,14 +104,14 @@ class EmitMysql(EmitBase):
# Abstraction for sqlite3 databases and sql syntax
class EmitSqlite3(EmitBase):
def execute(self, query, *args):
#print query + " %s\n" % str(tuple(args))
#print(query + " %s\n" % str(tuple(args)))
self.cursor.execute(query, *args)
def __init__(self, options, ctxcols, evcols):
import sqlite3
if options.database == None:
print "Have to specify database (file-)name for sqlite"
print("Have to specify database (file-)name for sqlite")
sys.exit(1)
if not options.update:
......@@ -187,7 +187,7 @@ class Conv:
fields = line.strip().split(";")
if fields[0] == 'P':
if (len(fields)-1) % 2 != 0:
print "%s: Invalid number of fields after 'P'" % linenr
print("%s: Invalid number of fields after 'P'" % linenr)
for i in range(1,len(fields),2):
key = fields[i]
......@@ -198,7 +198,7 @@ class Conv:
elif fields[0] == 'E':
if (len(fields)-1) % 2 != 0:
print "%s: Invalid number of fields after 'E'" % linenr
print("%s: Invalid number of fields after 'E'" % linenr)
self.n_events += 1
for i in range(1,len(fields),2):
......@@ -268,7 +268,7 @@ class Conv:
keyidx = self.ctxcols[key]
if self.ctxvals[keyidx] != None:
print "Error: context key '%s' pushed multiple times" % key
print("Error: context key '%s' pushed multiple times" % key)
sys.exit(1)
self.ctxvals[keyidx] = val
self.pushpending = True
......@@ -289,11 +289,11 @@ class Conv:
self.curr_id = idstack.pop()
if popkey != key:
print "unmatched pop in line %d, push key %s, pop key: %s" % (lineno, key, popkey)
print("unmatched pop in line %d, push key %s, pop key: %s" % (lineno, key, popkey))
keyidx = self.ctxcols[key]
if self.ctxvals[keyidx] == None:
print "Error: context key '%s' popped before it was pushed" % popkey
print("Error: context key '%s' popped before it was pushed" % popkey)
sys.exit(1)
self.ctxvals[keyidx] = None
......@@ -307,7 +307,7 @@ class Conv:
prec = curr_event * 10 / self.n_events
if prec > last_prec:
last_prec = prec
print '%10d / %10d' % (curr_event, self.n_events)
print('%10d / %10d' % (curr_event, self.n_events))
for p in range(1,len(items),2):
key = items[p]
......@@ -348,12 +348,12 @@ class Conv:
for file in files:
if not os.path.isfile(file):
print "cannot find input file %s" % (file, )
print("cannot find input file %s" % (file, ))
else:
self.files.append(file)
if len(self.files) < 1:
print "no input file to process"
print("no input file to process")
sys.exit(3)
if options.filter:
......@@ -364,27 +364,27 @@ class Conv:
if options.engine in self.engines:
engine = self.engines[options.engine]
else:
print 'engine %s not found' % options.engine
print 'we offer: %s' % self.engines.keys()
print('engine %s not found' % options.engine)
print('we offer: %s' % self.engines.keys())
sys.exit(0)
if options.verbose:
print "determining schema..."
print("determining schema...")
(ctxcols, evcols) = self.find_heads()
if options.verbose:
print "context schema:"
print ctxcols
print "event schema:"
print evcols
print("context schema:")
print(ctxcols)
print("event schema:")
print(evcols)
self.emit = engine(options, ctxcols, evcols)
if options.verbose:
print "filling tables..."
print("filling tables...")
self.fill_tables()
if options.verbose:
print "comitting..."
print("comitting...")
self.emit.commit()
if __name__ == "__main__":
......
......@@ -197,4 +197,4 @@ vcxfo = "/tmp/firm.vcxproj.filters"
os.system("xmllint --format /tmp/out.xml > %s" % vcxo)
os.system("xmllint --format /tmp/outf.xml > %s" % vcxfo)
print "Generated: %s %s" % (vcxo, vcxfo)
print("Generated: %s %s" % (vcxo, vcxfo))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment