diff options
author | Radostin Stoyanov <rstoyanov1@gmail.com> | 2018-09-23 17:31:52 +0300 |
---|---|---|
committer | Andrei Vagin <avagin@gmail.com> | 2018-10-30 19:28:01 +0300 |
commit | 147660f02f0cbf1c20623b6312c426cb60c3f3a4 (patch) | |
tree | 0f2eeb6d79d4b4fc8fbf9bcba8ccefb9198353f2 /soccr | |
parent | 7ce23b2a74196678a746d1402e5444179674c9a4 (diff) |
Convert to python3 style print() syntax
Use __future__ imports to keep this working for python2
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
Signed-off-by: Andrei Vagin <avagin@gmail.com>
Diffstat (limited to 'soccr')
-rw-r--r-- | soccr/test/run.py | 8 | ||||
-rwxr-xr-x | soccr/test/tcp-test.py | 7 |
2 files changed, 8 insertions, 7 deletions
diff --git a/soccr/test/run.py b/soccr/test/run.py index c4d81fbd2..a25c29263 100644 --- a/soccr/test/run.py +++ b/soccr/test/run.py @@ -12,7 +12,7 @@ dst = os.getenv("TCP_DST", "127.0.0.1") sport = os.getenv("TCP_SPORT", "12345") dport = os.getenv("TCP_DPORT", "54321") -print sys.argv[1] +print(sys.argv[1]) args = [sys.argv[1], "--addr", src, "--port", sport, "--seq", "555", "--next", @@ -41,7 +41,7 @@ m.update(str2) str2 = m.hexdigest() if str2 != eval(s): - print "FAIL", repr(str2), repr(s) + print("FAIL", repr(str2), repr(s)) sys.exit(5); s = p1.stdout.read() @@ -51,7 +51,7 @@ str1 = m.hexdigest() s = p2.stdout.read() if str1 != eval(s): - print "FAIL", repr(str1), s + print("FAIL", repr(str1), s) sys.exit(5); if p1.wait(): @@ -59,4 +59,4 @@ if p1.wait(): if p2.wait(): sys.exit(1) -print "PASS" +print("PASS") diff --git a/soccr/test/tcp-test.py b/soccr/test/tcp-test.py index f401fc067..ff3fe29dc 100755 --- a/soccr/test/tcp-test.py +++ b/soccr/test/tcp-test.py @@ -1,5 +1,6 @@ #!/usr/bin/env python2 +from __future__ import print_function import sys, socket import hashlib @@ -7,13 +8,13 @@ sk = socket.fromfd(3, socket.AF_INET, socket.SOCK_STREAM) s = sys.stdin.read() ret = sk.send(s) -print >> sys.stderr, "%s: send() -> %d" % (sys.argv[1], ret) +print("%s: send() -> %d" % (sys.argv[1], ret), file=sys.stderr) sk.shutdown(socket.SHUT_WR) m = hashlib.md5() while True: s = sk.recv((1 << 20) * 10) if not s: break - print >> sys.stderr, "%s: recv() -> %d" % (sys.argv[1], len(s)) + print("%s: recv() -> %d" % (sys.argv[1], len(s)), file=sys.stderr) m.update(s) -print repr(m.hexdigest()) +print(repr(m.hexdigest())) |