Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:eeich
ganglia
python-Fix-print-statements-for-python3.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File python-Fix-print-statements-for-python3.patch of Package ganglia
From: Egbert Eich <eich@suse.com> Date: Thu Feb 22 20:38:16 2018 +0100 Subject: python: Fix print statements for python3 Patch-mainline: never Git-commit: 018a2fcd4d8231149fd75707b3433e6cb9f8df85 References: Signed-off-by: Egbert Eich <eich@suse.com> --- gmond/python_modules/apache_status/apache_status.py | 10 +++++----- gmond/python_modules/cpu/cpu_stats.py | 8 ++++---- gmond/python_modules/db/mysql.py | 2 +- gmond/python_modules/db/riak.py | 4 ++-- gmond/python_modules/disk/diskstat.py | 4 ++-- gmond/python_modules/disk/multidisk.py | 4 ++-- gmond/python_modules/example/example.py | 6 +++--- gmond/python_modules/example/spfexample.py | 4 ++-- gmond/python_modules/memcached/memcached.py | 10 +++++----- gmond/python_modules/memory/mem_stats.py | 2 +- gmond/python_modules/network/multi_interface.py | 8 ++++---- gmond/python_modules/network/netstats.py | 12 ++++++------ gmond/python_modules/network/tcpconn.py | 4 ++-- gmond/python_modules/network/traffic1.py | 8 ++++---- gmond/python_modules/nfs/nfsstats.py | 2 +- gmond/python_modules/process/procstat.py | 12 ++++++------ gmond/python_modules/ssl/entropy.py | 2 +- gmond/python_modules/varnish/varnish.py | 4 ++-- gmond/python_modules/vm_stats/vm_stats.py | 8 ++++---- gmond/python_modules/xen/xenstats.py | 2 +- 20 files changed, 58 insertions(+), 58 deletions(-) diff --git a/gmond/python_modules/apache_status/apache_status.py b/gmond/python_modules/apache_status/apache_status.py index e33e5ea..f24458f 100755 --- a/gmond/python_modules/apache_status/apache_status.py +++ b/gmond/python_modules/apache_status/apache_status.py @@ -155,7 +155,7 @@ def get_delta(name): try: delta = multiplier * (float(curr_metrics['data'][name]) - float(last_metrics['data'][name])) / (curr_metrics['time'] - last_metrics['time']) if delta < 0: - print name + " is less 0" + print(name + " is less 0") delta = 0 except KeyError: delta = 0.0 @@ -173,8 +173,8 @@ def create_desc(prop): def metric_init(params): global descriptors, Desc_Skel, SERVER_STATUS_URL, COLLECT_SSL - print '[apache_status] Received the following parameters' - print params + print('[apache_status] Received the following parameters') + print(params) if "metric_group" not in params: params["metric_group"] = "apache" @@ -400,9 +400,9 @@ if __name__ == '__main__': for d in descriptors: v = d['call_back'](d['name']) if d['name'] == NAME_PREFIX + "rps": - print 'value for %s is %.4f' % (d['name'], v) + print('value for %s is %.4f' % (d['name'], v)) else: - print 'value for %s is %s' % (d['name'], v) + print('value for %s is %s' % (d['name'], v)) time.sleep(15) except KeyboardInterrupt: os._exit(1) diff --git a/gmond/python_modules/cpu/cpu_stats.py b/gmond/python_modules/cpu/cpu_stats.py index 5a8ebb8..160ef23 100644 --- a/gmond/python_modules/cpu/cpu_stats.py +++ b/gmond/python_modules/cpu/cpu_stats.py @@ -97,7 +97,7 @@ def get_delta(name): try: delta = (float(curr_metrics['data'][name][0]) - float(last_metrics['data'][name][0])) / (curr_metrics['time'] - last_metrics['time']) if delta < 0: - print name + " is less 0" + print(name + " is less 0") delta = 0 except KeyError: delta = 0.0 @@ -124,7 +124,7 @@ def get_softirq_delta(name): try: delta = (float(curr_metrics['data']['softirq'][index]) - float(last_metrics['data']['softirq'][index])) / (curr_metrics['time'] - last_metrics['time']) if delta < 0: - print name + " is less 0" + print(name + " is less 0") delta = 0 except KeyError: delta = 0.0 @@ -279,6 +279,6 @@ if __name__ == '__main__': while True: for d in descriptors: v = d['call_back'](d['name']) - print '%s = %s' % (d['name'], v) - print 'Sleeping 15 seconds' + print('%s = %s' % (d['name'], v)) + print('Sleeping 15 seconds') time.sleep(5) diff --git a/gmond/python_modules/db/mysql.py b/gmond/python_modules/db/mysql.py index 7b5ab59..e7a7edb 100644 --- a/gmond/python_modules/db/mysql.py +++ b/gmond/python_modules/db/mysql.py @@ -1165,7 +1165,7 @@ if __name__ == '__main__': for d in descriptors: v = d['call_back'](d['name']) if not options.quiet: - print ' %s: %s %s [%s]' % (d['name'], v, d['units'], d['description']) + print(' %s: %s %s [%s]' % (d['name'], v, d['units'], d['description'])) if options.gmetric: if d['value_type'] == 'uint': diff --git a/gmond/python_modules/db/riak.py b/gmond/python_modules/db/riak.py index 908b480..e6a1552 100755 --- a/gmond/python_modules/db/riak.py +++ b/gmond/python_modules/db/riak.py @@ -37,7 +37,7 @@ Debug = False def dprint(f, *v): if Debug: - print >>sys.stderr, "DEBUG: " + f % v + print( "DEBUG: " + f % v, file=sys.stderr) def floatable(str): @@ -116,7 +116,7 @@ def metric_init(params): if "metrix_prefix" not in params: params["metrix_prefix"] = "riak" - print params + print(params) # initialize skeleton of descriptors Desc_Skel = { diff --git a/gmond/python_modules/disk/diskstat.py b/gmond/python_modules/disk/diskstat.py index 4cde607..79962ca 100644 --- a/gmond/python_modules/disk/diskstat.py +++ b/gmond/python_modules/disk/diskstat.py @@ -532,7 +532,7 @@ if __name__ == '__main__': for d in descriptors: v = d['call_back'](d['name']) if not options.quiet: - print ' %s: %s %s [%s]' % (d['name'], v, d['units'], d['description']) + print(' %s: %s %s [%s]' % (d['name'], v, d['units'], d['description'])) if options.gmetric: if d['value_type'] == 'uint': @@ -544,5 +544,5 @@ if __name__ == '__main__': (options.gmetric_bin, options.gmond_conf, v, d['units'], value_type, d['name'], d['slope']) os.system(cmd) - print 'Sleeping 15 seconds' + print('Sleeping 15 seconds') time.sleep(15) diff --git a/gmond/python_modules/disk/multidisk.py b/gmond/python_modules/disk/multidisk.py index 5dff161..b26bf59 100644 --- a/gmond/python_modules/disk/multidisk.py +++ b/gmond/python_modules/disk/multidisk.py @@ -118,7 +118,7 @@ def metric_init(params): continue if ganglia.get_debug_msg_level() > 1: - print 'Discovered device %s' % line[1] + print('Discovered device %s' % line[1]) descriptors.append(Init_Metric(line, 'disk_total', int(1200), 'double', 'GB', 'both', '%.3f', @@ -140,4 +140,4 @@ if __name__ == '__main__': metric_init(None) for d in descriptors: v = d['call_back'](d['name']) - print 'value for %s is %f' % (d['name'], v) + print('value for %s is %f' % (d['name'], v)) diff --git a/gmond/python_modules/example/example.py b/gmond/python_modules/example/example.py index c35d40d..82faa30 100644 --- a/gmond/python_modules/example/example.py +++ b/gmond/python_modules/example/example.py @@ -54,8 +54,8 @@ def metric_init(params): global Constant_Value random.seed() - print '[pyexample] Received the following parameters' - print params + print('[pyexample] Received the following parameters') + print(params) if 'RandomMax' in params: Random_Max = int(params['RandomMax']) @@ -97,4 +97,4 @@ if __name__ == '__main__': metric_init(params) for d in descriptors: v = d['call_back'](d['name']) - print 'value for %s is %u' % (d['name'], v) + print('value for %s is %u' % (d['name'], v)) diff --git a/gmond/python_modules/example/spfexample.py b/gmond/python_modules/example/spfexample.py index 0baf97e..85e3610 100644 --- a/gmond/python_modules/example/spfexample.py +++ b/gmond/python_modules/example/spfexample.py @@ -133,5 +133,5 @@ if __name__ == '__main__': d = metric_init(params) for d in descriptors: v = d['call_back'](d['name']) - print 'value for %s is %s' % (d['name'], str(v)) - print d + print('value for %s is %s' % (d['name'], str(v))) + print (d) diff --git a/gmond/python_modules/memcached/memcached.py b/gmond/python_modules/memcached/memcached.py index 7db7616..0d6c8e6 100644 --- a/gmond/python_modules/memcached/memcached.py +++ b/gmond/python_modules/memcached/memcached.py @@ -19,7 +19,7 @@ Debug = False def dprint(f, *v): if Debug: - print >>sys.stderr, "DEBUG: " + f % v + print ("DEBUG: " + f % v, file=sys.stderr) def floatable(str): @@ -86,7 +86,7 @@ class UpdateMetricThread(threading.Thread): rfd, wfd, xfd = select.select([sock], [], [], self.timeout) if not rfd: - print >>sys.stderr, "ERROR: select timeout" + print ("ERROR: select timeout", file=sys.stderr) break for fd in rfd: @@ -106,7 +106,7 @@ class UpdateMetricThread(threading.Thread): sock.close() except socket.error, e: - print >>sys.stderr, "ERROR: %s" % e + print ("ERROR: %s" % e, file=sys.stderr) for m in msg.split("\r\n"): d = m.split(" ") @@ -140,7 +140,7 @@ class UpdateMetricThread(threading.Thread): def metric_init(params): global descriptors, Desc_Skel, _Worker_Thread, Debug - print '[memcached] memcached protocol "stats"' + print ('[memcached] memcached protocol "stats"') if "type" not in params: params["type"] = "memcached" @@ -150,7 +150,7 @@ def metric_init(params): elif params["type"] == "Tokyo Tyrant": params["metrix_prefix"] = "tt" - print params + print (params) # initialize skeleton of descriptors Desc_Skel = { diff --git a/gmond/python_modules/memory/mem_stats.py b/gmond/python_modules/memory/mem_stats.py index 932a85b..976a437 100644 --- a/gmond/python_modules/memory/mem_stats.py +++ b/gmond/python_modules/memory/mem_stats.py @@ -384,4 +384,4 @@ if __name__ == '__main__': metric_init({}) for d in descriptors: v = d['call_back'](d['name']) - print 'value for %s is %f' % (d['name'], v) + print('value for %s is %f' % (d['name'], v)) diff --git a/gmond/python_modules/network/multi_interface.py b/gmond/python_modules/network/multi_interface.py index 3f9b45d..af99c04 100644 --- a/gmond/python_modules/network/multi_interface.py +++ b/gmond/python_modules/network/multi_interface.py @@ -242,7 +242,7 @@ def get_aggregates(name): try: delta = (float(curr_metrics['data'][iface][index]) - float(last_metrics['data'][iface][index])) / (curr_metrics['time'] - last_metrics['time']) if delta < 0: - print name + " is less 0" + print(name + " is less 0") delta = 0 except KeyError: delta = 0.0 @@ -300,7 +300,7 @@ def get_delta(name): try: delta = (float(curr_metrics['data'][iface][index]) - float(last_metrics['data'][iface][index])) / (curr_metrics['time'] - last_metrics['time']) if delta < 0: - print name + " is less 0" + print(name + " is less 0") delta = 0 except KeyError: delta = 0.0 @@ -320,8 +320,8 @@ if __name__ == '__main__': while True: for d in descriptors: v = d['call_back'](d['name']) - print ('value for %s is ' + d['format']) % (d['name'], v) + print(('value for %s is ' + d['format']) % (d['name'], v)) time.sleep(5) except StandardError: - print sys.exc_info()[0] + print(sys.exc_info()[0]) os._exit(1) diff --git a/gmond/python_modules/network/netstats.py b/gmond/python_modules/network/netstats.py index f9c6795..14191e4 100644 --- a/gmond/python_modules/network/netstats.py +++ b/gmond/python_modules/network/netstats.py @@ -94,7 +94,7 @@ def get_delta(name): try: delta = (float(curr_metrics['data'][group][metric]) - float(last_metrics['data'][group][metric])) / (curr_metrics['time'] - last_metrics['time']) if delta < 0: - print name + " is less 0" + print(name + " is less 0") delta = 0 except KeyError: delta = 0.0 @@ -110,7 +110,7 @@ def get_tcploss_percentage(name): try: pct = 100 * (float(curr_metrics['data']['tcpext']["tcploss"]) - float(last_metrics["data"]['tcpext']["tcploss"])) / (float(curr_metrics['data']['tcp']['outsegs']) + float(curr_metrics['data']['tcp']['insegs']) - float(last_metrics['data']['tcp']['insegs']) - float(last_metrics['data']['tcp']['outsegs'])) if pct < 0: - print name + " is less 0" + print(name + " is less 0") pct = 0 except KeyError: pct = 0.0 @@ -128,7 +128,7 @@ def get_tcpattemptfail_percentage(name): try: pct = 100 * (float(curr_metrics['data']['tcp']["attemptfails"]) - float(last_metrics["data"]['tcp']["attemptfails"])) / (float(curr_metrics['data']['tcp']['outsegs']) + float(curr_metrics['data']['tcp']['insegs']) - float(last_metrics['data']['tcp']['insegs']) - float(last_metrics['data']['tcp']['outsegs'])) if pct < 0: - print name + " is less 0" + print(name + " is less 0") pct = 0 except Exception: pct = 0.0 @@ -144,7 +144,7 @@ def get_retrans_percentage(name): try: pct = 100 * (float(curr_metrics['data']['tcp']["retranssegs"]) - float(last_metrics['data']['tcp']["retranssegs"])) / (float(curr_metrics['data']['tcp']['outsegs']) + float(curr_metrics['data']['tcp']['insegs']) - float(last_metrics['data']['tcp']['insegs']) - float(last_metrics['data']['tcp']['outsegs'])) if pct < 0: - print name + " is less 0" + print(name + " is less 0") pct = 0 except KeyError: pct = 0.0 @@ -253,6 +253,6 @@ if __name__ == '__main__': while True: for d in descriptors: v = d['call_back'](d['name']) - print '%s = %s' % (d['name'], v) - print 'Sleeping 15 seconds' + print('%s = %s' % (d['name'], v)) + print('Sleeping 15 seconds') time.sleep(15) diff --git a/gmond/python_modules/network/tcpconn.py b/gmond/python_modules/network/tcpconn.py index 71bcc0f..73abb41 100644 --- a/gmond/python_modules/network/tcpconn.py +++ b/gmond/python_modules/network/tcpconn.py @@ -68,7 +68,7 @@ def TCP_Connections(name): global _WorkerThread if _WorkerThread is None: - print 'Error: No netstat data gathering thread created for metric %s' % name + print('Error: No netstat data gathering thread created for metric %s' % name) return 0 if not _WorkerThread.running and not _WorkerThread.shuttingdown: @@ -361,7 +361,7 @@ if __name__ == '__main__': try: for d in _descriptors: v = d['call_back'](d['name']) - print 'value for %s is %u' % (d['name'], v) + print('value for %s is %u' % (d['name'], v)) time.sleep(5) except KeyboardInterrupt: os._exit(1) diff --git a/gmond/python_modules/network/traffic1.py b/gmond/python_modules/network/traffic1.py index 9e2b252..98ac251 100644 --- a/gmond/python_modules/network/traffic1.py +++ b/gmond/python_modules/network/traffic1.py @@ -16,7 +16,7 @@ Debug = False def dprint(f, *v): if Debug: - print >> sys.stderr, "DEBUG: " + f % v + print( "DEBUG: " + f % v, file=sys.stderr) class UpdateTrafficThread(threading.Thread): @@ -104,8 +104,8 @@ class UpdateTrafficThread(threading.Thread): def metric_init(params): global Desc_Skel, _Worker_Thread, Debug - print '[traffic1] Received the following parameters' - print params + print('[traffic1] Received the following parameters') + print(params) Desc_Skel = { 'name' : 'XXX', @@ -201,5 +201,5 @@ if __name__ == '__main__': time.sleep(0.2) os._exit(1) except StandardError: - print sys.exc_info()[0] + print(sys.exc_info()[0]) os._exit(1) diff --git a/gmond/python_modules/nfs/nfsstats.py b/gmond/python_modules/nfs/nfsstats.py index a383101..61e663e 100644 --- a/gmond/python_modules/nfs/nfsstats.py +++ b/gmond/python_modules/nfs/nfsstats.py @@ -388,7 +388,7 @@ def debug(level, text): if level > verboselevel: return if sys.stderr.isatty(): - print text + print(text) else: syslog.syslog(text) diff --git a/gmond/python_modules/process/procstat.py b/gmond/python_modules/process/procstat.py index b26849b..b07ece7 100644 --- a/gmond/python_modules/process/procstat.py +++ b/gmond/python_modules/process/procstat.py @@ -36,7 +36,7 @@ ### $ python procstat.py -p test -v 'wrong' -t ### Testing test: wrong ### failed getting pgid: no process returned -### ps -Ao pid,ppid,pgid,args | awk 'wrong && $2 == 1 && !/awk/ && !/procstat\.py/ {print $0}' +### ps -Ao pid,ppid,pgid,args | awk 'wrong && $2 == 1 && !/awk/ && !/procstat\.py/ {print($0)}' ### ### -- This example shows a regex that returns more than one process ### with a ppid of 1. @@ -44,7 +44,7 @@ ### $ python procstat.py -p test -v '/mingetty/' -t ### Testing test: /mingetty/ ### failed getting pgid: more than 1 result returned -### ps -Ao pid,ppid,pgid,args | awk '/mingetty/ && $2 == 1 && !/awk/ && !/procstat\.py/ {print $0}' +### ps -Ao pid,ppid,pgid,args | awk '/mingetty/ && $2 == 1 && !/awk/ && !/procstat\.py/ {print($0)}' ### 7313 1 7313 /sbin/mingetty tty1 ### 7314 1 7314 /sbin/mingetty tty2 ### 7315 1 7315 /sbin/mingetty tty3 @@ -160,7 +160,7 @@ def get_pgid(proc): else: # This is a regex, lets search for it regex = PROCESSES[proc] - cmd = "ps -Ao pid,ppid,pgid,args | awk '" + regex + " && $2 == 1 && !/awk/ && !/procstat\.py/ {print $0}'" + cmd = "ps -Ao pid,ppid,pgid,args | awk '" + regex + " && $2 == 1 && !/awk/ && !/procstat\.py/ {print($0)}'" p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() @@ -433,7 +433,7 @@ def display_proc_stat(pid): # Display them i = 0 for f in fields: - print '%15s: %s' % (f, stat[i]) + print('%15s: %s' % (f, stat[i])) i += 1 except: @@ -452,7 +452,7 @@ def display_proc_statm(pid): # Display them i = 0 for f in fields: - print '%15s: %s' % (f, statm[i]) + print('%15s: %s' % (f, statm[i])) i += 1 except: @@ -510,7 +510,7 @@ if __name__ == '__main__': for d in descriptors: v = d['call_back'](d['name']) if not options.quiet: - print ' %s: %s %s [%s]' % (d['name'], d['format'] % v, d['units'], d['description']) + print(' %s: %s %s [%s]' % (d['name'], d['format'] % v, d['units'], d['description'])) if options.gmetric: if d['value_type'] == 'uint': diff --git a/gmond/python_modules/ssl/entropy.py b/gmond/python_modules/ssl/entropy.py index 8337981..71193c6 100644 --- a/gmond/python_modules/ssl/entropy.py +++ b/gmond/python_modules/ssl/entropy.py @@ -53,4 +53,4 @@ if __name__ == '__main__': metric_init({}) for d in descriptors: v = d['call_back'](d['name']) - print 'value for %s is %u' % (d['name'], v) + print('value for %s is %u' % (d['name'], v)) diff --git a/gmond/python_modules/varnish/varnish.py b/gmond/python_modules/varnish/varnish.py index f8c0723..81c3d77 100755 --- a/gmond/python_modules/varnish/varnish.py +++ b/gmond/python_modules/varnish/varnish.py @@ -109,7 +109,7 @@ def get_delta(name): try: delta = float(curr_metrics['data'][name] - last_metrics['data'][name]) / (curr_metrics['time'] - last_metrics['time']) if delta < 0: - print "Less than 0" + print("Less than 0") delta = 0 except StandardError: delta = 0 @@ -1039,5 +1039,5 @@ if __name__ == '__main__': while True: for d in descriptors: print (('%s = %s') % (d['name'], d['format'])) % (d['call_back'](d['name'])) - print 'Sleeping 15 seconds' + print ('Sleeping 15 seconds') time.sleep(15) diff --git a/gmond/python_modules/vm_stats/vm_stats.py b/gmond/python_modules/vm_stats/vm_stats.py index ed663de..c779e43 100644 --- a/gmond/python_modules/vm_stats/vm_stats.py +++ b/gmond/python_modules/vm_stats/vm_stats.py @@ -86,7 +86,7 @@ def get_delta(name): try: delta = (float(curr_metrics['data'][name]) - float(last_metrics['data'][name])) / (curr_metrics['time'] - last_metrics['time']) if delta < 0: - print name + " is less 0" + print(name + " is less 0") delta = 0 except KeyError: delta = 0.0 @@ -112,7 +112,7 @@ def get_vmeff(name): delta = 100 * (float(curr_metrics['data']['pgsteal_normal']) - float(last_metrics['data']['pgsteal_normal'])) / pgscan_diff if delta < 0: - print name + " is less 0" + print(name + " is less 0") delta = 0 except KeyError: delta = 0.0 @@ -734,6 +734,6 @@ if __name__ == '__main__': while True: for d in descriptors: v = d['call_back'](d['name']) - print '%s = %s' % (d['name'], v) - print 'Sleeping 15 seconds' + print('%s = %s' % (d['name'], v)) + print('Sleeping 15 seconds') time.sleep(15) diff --git a/gmond/python_modules/xen/xenstats.py b/gmond/python_modules/xen/xenstats.py index 67a6c21..bdb3750 100755 --- a/gmond/python_modules/xen/xenstats.py +++ b/gmond/python_modules/xen/xenstats.py @@ -128,4 +128,4 @@ if __name__ == '__main__': metric_init('init') for d in descriptors: v = d['call_back'](d['name']) - print 'value for %s is %u' % (d['name'], v) + print('value for %s is %u' % (d['name'], v))
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor