Conversion to python3, using 2to3.

This commit is contained in:
Cas Cremers
2020-10-27 22:09:03 +01:00
parent eecf68dc98
commit 3a6041ccac
34 changed files with 245 additions and 245 deletions

View File

@@ -52,7 +52,7 @@ def evaluate(fn,prefix=""):
fstderr.seek(0)
res = ""
for l in fstdout.xreadlines():
for l in fstdout:
res += prefix + l.strip() + "\n"
#for l in fstderr.xreadlines():
# print l
@@ -72,7 +72,7 @@ def main():
cnt = 1
tres = ""
for (prefix,fn) in sorted(fl):
print "Evaluating %s (%i/%i)" % (fn,cnt,len(fl))
print("Evaluating %s (%i/%i)" % (fn,cnt,len(fl)))
res = evaluate(prefix+fn, "%s\t" % (fn))
fp.write(res)
tres += res
@@ -83,7 +83,7 @@ def main():
fp.write(tres)
fp.close()
print res
print(res)

View File

@@ -30,7 +30,7 @@
# Note 2: this code assumes that both scyther-linux and dot can be found in the
# environment (i.e. PATH variable)
#
import os,sys,commands
import os,sys,subprocess
import os.path
tempcount = 0
@@ -59,7 +59,7 @@ def scyther_to_dotfile():
tmpdotfile = generateTemp('dot')
command = "%s --plain --dot-output %s > %s" % (scythername, args, tmpdotfile)
output = commands.getoutput(command)
output = subprocess.getoutput(command)
return (output,tmpdotfile)
def dotfile_to_pdffile(dotfile,outfile=None):
@@ -72,10 +72,10 @@ def dotfile_to_pdffile(dotfile,outfile=None):
# it fit to a landscape page
dotdata = open(dotfile, "r")
f = None
for line in dotdata.xreadlines():
for line in dotdata:
if (line.find('digraph') == 0):
f = os.popen("dot -Gsize='11.0,8.0' -Gratio=fill -Tps >>%s" % (tmp),'w')
print >>f, line
print(line, file=f)
dotdata.close()
if not f:
@@ -96,18 +96,18 @@ def dotfile_to_pdffile(dotfile,outfile=None):
def main():
(output,dotfile) = scyther_to_dotfile()
print output
print(output)
pdffile = dotfile_to_pdffile(dotfile)
os.unlink(dotfile)
if pdffile:
commands.getoutput("kpdf %s" % pdffile)
subprocess.getoutput("kpdf %s" % pdffile)
os.unlink(pdffile)
else:
print "No graphs generated."
print("No graphs generated.")
if __name__ == '__main__':
if len(sys.argv) > 1:
main()
else:
print "Please provide the name of an input file."
print("Please provide the name of an input file.")