pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sanjee...@apache.org
Subject [pulsar] branch master updated: Make scripts run on python2 and python3 (#3356)
Date Fri, 11 Jan 2019 01:06:52 GMT
This is an automated email from the ASF dual-hosted git repository.

sanjeevrk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 69ab1f5  Make scripts run on python2 and python3 (#3356)
69ab1f5 is described below

commit 69ab1f55f31e7e57d383f0727d9fd26c4249d7a5
Author: Ali Ahmed <alahmed.se@gmail.com>
AuthorDate: Thu Jan 10 17:06:47 2019 -0800

    Make scripts run on python2 and python3 (#3356)
---
 docker/pulsar/scripts/apply-config-from-env.py |  4 ++--
 docker/pulsar/scripts/gen-yml-from-env.py      |  2 +-
 docker/pulsar/scripts/watch-znode.py           | 24 ++++++++++++------------
 3 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/docker/pulsar/scripts/apply-config-from-env.py b/docker/pulsar/scripts/apply-config-from-env.py
index ae16268..0ad9b2b 100755
--- a/docker/pulsar/scripts/apply-config-from-env.py
+++ b/docker/pulsar/scripts/apply-config-from-env.py
@@ -28,7 +28,7 @@
 import os, sys
 
 if len(sys.argv) < 2:
-    print 'Usage: %s' % (sys.argv[0])
+    print('Usage: %s' % (sys.argv[0]))
     sys.exit(1)
 
 # Always apply env config to env scripts as well
@@ -52,7 +52,7 @@ for conf_filename in conf_files:
     for k in sorted(os.environ.keys()):
         v = os.environ[k]
         if k in keys:
-            print '[%s] Applying config %s = %s' % (conf_filename, k, v)
+            print('[%s] Applying config %s = %s' % (conf_filename, k, v))
             idx = keys[k]
             lines[idx] = '%s=%s\n' % (k, v)
 
diff --git a/docker/pulsar/scripts/gen-yml-from-env.py b/docker/pulsar/scripts/gen-yml-from-env.py
index 45fe2a5..4feea57 100755
--- a/docker/pulsar/scripts/gen-yml-from-env.py
+++ b/docker/pulsar/scripts/gen-yml-from-env.py
@@ -40,7 +40,7 @@ INT_KEYS = [
 PF_ENV_PREFIX = 'PF_'
 
 if len(sys.argv) < 2:
-    print 'Usage: %s' % (sys.argv[0])
+    print('Usage: %s' % (sys.argv[0]))
     sys.exit(1)
 
 conf_files = sys.argv[1:]
diff --git a/docker/pulsar/scripts/watch-znode.py b/docker/pulsar/scripts/watch-znode.py
index 6e8d55d..2aacffd 100755
--- a/docker/pulsar/scripts/watch-znode.py
+++ b/docker/pulsar/scripts/watch-znode.py
@@ -26,18 +26,18 @@ from kazoo.retry import KazooRetry
 logging.getLogger('kazoo.client').addHandler(logging.StreamHandler())
 
 def usage():
-    print >> sys.stderr, "\n%s -z <zookeeper> -p <path> [-w|-c|-e]" % (sys.argv[0])
-    print >> sys.stderr, "\nWait for, or create znode"
-    print >> sys.stderr, "\n-z Specify zookeeper connect string"
-    print >> sys.stderr, "\n-p Znode path to watch or create"
-    print >> sys.stderr, "\n-w Watch for path creation"
-    print >> sys.stderr, "\n-c Create path"
-    print >> sys.stderr, "\n-e Check if znode exists"
+    print("\n%s -z <zookeeper> -p <path> [-w|-c|-e]" % (sys.argv[0]), file=sys.stderr)
+    print("\nWait for, or create znode", file=sys.stderr)
+    print("\n-z Specify zookeeper connect string", file=sys.stderr)
+    print("\n-p Znode path to watch or create", file=sys.stderr)
+    print("\n-w Watch for path creation", file=sys.stderr)
+    print("\n-c Create path", file=sys.stderr)
+    print("\n-e Check if znode exists", file=sys.stderr)
 
 try:
     opts, args = getopt.getopt(sys.argv[1:], "z:p:cweh")
 except getopt.GetoptError as err:
-    print >> sys.stderr, str(err)
+    print(str(err), file=sys.stderr)
     usage()
     sys.exit(2)
 
@@ -67,17 +67,17 @@ for o, a in opts:
         sys.exit(2)
 
 if not zookeeper:
-    print >> sys.stderr, "Zookeeper must be specified"
+    print("Zookeeper must be specified", file=sys.stderr)
     usage()
     sys.exit(3)
 
 if not znode:
-    print >> sys.stderr, "Znode must be specified"
+    print("Znode must be specified", file=sys.stderr)
     usage()
     sys.exit(4)
 
 if (not watch and not create and not exists):
-    print >> sys.stderr, "Exactly one of watch (-w), create (-c) or exists (-e) must
be specified"
+    print("Exactly one of watch (-w), create (-c) or exists (-e) must be specified", file=sys.stderr)
     usage()
     sys.exit(5)
 
@@ -93,7 +93,7 @@ while True:
             sys.exit(0)
         elif watch:
             while not zk.exists(znode):
-                print "Waiting for %s" % znode
+                print("Waiting for %s" % znode)
                 time.sleep(1)
             sys.exit(0)
         elif exists:


Mime
View raw message