[PATCH 1 of 8] zeroconf: use print function

timeless timeless at mozdev.org
Tue Mar 1 10:39:03 UTC 2016


# HG changeset patch
# User timeless <timeless at mozdev.org>
# Date 1456816652 0
#      Tue Mar 01 07:17:32 2016 +0000
# Node ID 7cd59c489eb07dc9ff38a8ce237c77ddc611eb94
# Parent  c7f89ad87baef87f00c507545dfd4cc824bc3131
zeroconf: use print function

diff --git a/hgext/zeroconf/Zeroconf.py b/hgext/zeroconf/Zeroconf.py
--- a/hgext/zeroconf/Zeroconf.py
+++ b/hgext/zeroconf/Zeroconf.py
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 """ Multicast DNS Service Discovery for Python, v0.12
     Copyright (C) 2003, Paul Scott-Murphy
 
@@ -1558,23 +1560,23 @@
 # query (for Zoe), and service unregistration.
 
 if __name__ == '__main__':
-	print "Multicast DNS Service Discovery for Python, version", __version__
+	print("Multicast DNS Service Discovery for Python, version", __version__)
 	r = Zeroconf()
-	print "1. Testing registration of a service..."
+	print("1. Testing registration of a service...")
 	desc = {'version':'0.10','a':'test value', 'b':'another value'}
 	info = ServiceInfo("_http._tcp.local.", "My Service Name._http._tcp.local.", socket.inet_aton("127.0.0.1"), 1234, 0, 0, desc)
-	print "   Registering service..."
+	print("   Registering service...")
 	r.registerService(info)
-	print "   Registration done."
-	print "2. Testing query of service information..."
-	print "   Getting ZOE service:", str(r.getServiceInfo("_http._tcp.local.", "ZOE._http._tcp.local."))
-	print "   Query done."
-	print "3. Testing query of own service..."
-	print "   Getting self:", str(r.getServiceInfo("_http._tcp.local.", "My Service Name._http._tcp.local."))
-	print "   Query done."
-	print "4. Testing unregister of service information..."
+	print("   Registration done.")
+	print("2. Testing query of service information...")
+	print("   Getting ZOE service:", str(r.getServiceInfo("_http._tcp.local.", "ZOE._http._tcp.local.")))
+	print("   Query done.")
+	print("3. Testing query of own service...")
+	print("   Getting self:", str(r.getServiceInfo("_http._tcp.local.", "My Service Name._http._tcp.local.")))
+	print("   Query done.")
+	print("4. Testing unregister of service information...")
 	r.unregisterService(info)
-	print "   Unregister done."
+	print("   Unregister done.")
 	r.close()
 
 # no-check-code
diff --git a/tests/test-check-py3-compat.t b/tests/test-check-py3-compat.t
--- a/tests/test-check-py3-compat.t
+++ b/tests/test-check-py3-compat.t
@@ -87,7 +87,6 @@
   hgext/win32mbcs.py not using absolute_import
   hgext/win32text.py not using absolute_import
   hgext/zeroconf/Zeroconf.py not using absolute_import
-  hgext/zeroconf/Zeroconf.py requires print_function
   hgext/zeroconf/__init__.py not using absolute_import
   i18n/check-translation.py not using absolute_import
   i18n/polib.py not using absolute_import


More information about the Mercurial-devel mailing list