--- a/tests/test-check-py3-compat.t Mon Mar 28 04:02:07 2016 +0000
+++ b/tests/test-check-py3-compat.t Mon Mar 28 01:57:44 2016 +0530
@@ -117,7 +117,6 @@
tests/test-url.py requires print_function
tests/test-walkrepo.py requires print_function
tests/test-wireproto.py requires print_function
- tests/tinyproxy.py requires print_function
#if py3exe
$ hg files 'set:(**.py)' | sed 's|\\|/|g' | xargs $PYTHON3 contrib/check-py3-compat.py
@@ -303,6 +302,5 @@
tests/test-ui-verbosity.py: invalid syntax: Missing parentheses in call to 'print' (<unknown>, line *) (glob)
tests/test-walkrepo.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
tests/test-wireproto.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
- tests/tinyproxy.py: invalid syntax: Missing parentheses in call to 'print' (<unknown>, line *) (glob)
#endif
--- a/tests/tinyproxy.py Mon Mar 28 04:02:07 2016 +0000
+++ b/tests/tinyproxy.py Mon Mar 28 01:57:44 2016 +0530
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-from __future__ import absolute_import
+from __future__ import absolute_import, print_function
__doc__ = """Tiny HTTP Proxy.
@@ -50,7 +50,7 @@
host_port = netloc[:i], int(netloc[i + 1:])
else:
host_port = netloc, 80
- print "\t" "connect to %s:%d" % host_port
+ print("\t" "connect to %s:%d" % host_port)
try: soc.connect(host_port)
except socket.error as arg:
try: msg = arg[1]
@@ -70,7 +70,7 @@
self.wfile.write("\r\n")
self._read_write(soc, 300)
finally:
- print "\t" "bye"
+ print("\t" "bye")
soc.close()
self.connection.close()
@@ -95,7 +95,7 @@
soc.send("\r\n")
self._read_write(soc)
finally:
- print "\t" "bye"
+ print("\t" "bye")
soc.close()
self.connection.close()
@@ -122,7 +122,7 @@
out.send(data)
count = 0
else:
- print "\t" "idle", count
+ print("\t" "idle", count)
if count == max_idling:
break
@@ -142,16 +142,16 @@
if __name__ == '__main__':
from sys import argv
if argv[1:] and argv[1] in ('-h', '--help'):
- print argv[0], "[port [allowed_client_name ...]]"
+ print(argv[0], "[port [allowed_client_name ...]]")
else:
if argv[2:]:
allowed = []
for name in argv[2:]:
client = socket.gethostbyname(name)
allowed.append(client)
- print "Accept: %s (%s)" % (client, name)
+ print("Accept: %s (%s)" % (client, name))
ProxyHandler.allowed_clients = allowed
del argv[2:]
else:
- print "Any clients will be served..."
+ print("Any clients will be served...")
BaseHTTPServer.test(ProxyHandler, ThreadingHTTPServer)