From 4e7b423d3c3137c3f83b71b36279e1a544154833 Mon Sep 17 00:00:00 2001 From: "Kaleb S. KEITHLEY" Date: Fri, 13 Apr 2018 09:13:16 -0400 Subject: core/various: python3 compat, prepare for python2 -> python3 see https://review.gluster.org/#/c/19788/ use print fn from __future__ Change-Id: If5075d8d9ca9641058fbc71df8a52aa35804cda4 updates: #411 Signed-off-by: Kaleb S. KEITHLEY --- xlators/experimental/jbr-server/src/gen-fops.py | 39 +++++++++++++------------ 1 file changed, 20 insertions(+), 19 deletions(-) (limited to 'xlators/experimental/jbr-server') diff --git a/xlators/experimental/jbr-server/src/gen-fops.py b/xlators/experimental/jbr-server/src/gen-fops.py index 2005e3932d4..e728f473372 100755 --- a/xlators/experimental/jbr-server/src/gen-fops.py +++ b/xlators/experimental/jbr-server/src/gen-fops.py @@ -5,6 +5,7 @@ # between leader and followers (including fan-out), and basic error checking # to be centralized one place, with per-operation code kept to a minimum. +from __future__ import print_function import os import re import string @@ -132,49 +133,49 @@ def gen_server (templates): if ("fsync" in flags) or ("queue" in flags): flags.append("need_fd") for fname in flags: - print "#define JBR_CG_%s" % fname.upper() + print("#define JBR_CG_%s" % fname.upper()) if 'complete' in gen_funcs: - print generate(templates[kind+"-complete"], - name,cbk_subs) + print(generate(templates[kind+"-complete"], + name,cbk_subs)) if 'continue' in gen_funcs: - print generate(templates[kind+"-continue"], - name,fop_subs) + print(generate(templates[kind+"-continue"], + name,fop_subs)) if 'fan-in' in gen_funcs: - print generate(templates[kind+"-fan-in"], - name,cbk_subs) + print(generate(templates[kind+"-fan-in"], + name,cbk_subs)) if 'dispatch' in gen_funcs: - print generate(templates[kind+"-dispatch"], - name,fop_subs) + print(generate(templates[kind+"-dispatch"], + name,fop_subs)) if 'call_dispatch' in gen_funcs: - print generate(templates[kind+"-call_dispatch"], - name,fop_subs) + print(generate(templates[kind+"-call_dispatch"], + name,fop_subs)) if 'perform_local_op' in gen_funcs: - print generate(templates[kind+"-perform_local_op"], - name, fop_subs) + print(generate(templates[kind+"-perform_local_op"], + name, fop_subs)) if 'fop' in gen_funcs: - print generate(templates[kind+"-fop"],name,fop_subs) + print(generate(templates[kind+"-fop"],name,fop_subs)) for fname in flags: - print "#undef JBR_CG_%s" % fname.upper() + print("#undef JBR_CG_%s" % fname.upper()) fops_done.append(name) # Just for fun, emit the fops table too. print("struct xlator_fops fops = {") for x in fops_done: - print(" .%s = jbr_%s,"%(x,x)) + print((" .%s = jbr_%s,"%(x,x))) print("};") tmpl = load_templates(sys.argv[1]) for l in open(sys.argv[2],'r').readlines(): if l.find('#pragma generate') != -1: - print "/* BEGIN GENERATED CODE - DO NOT MODIFY */" + print("/* BEGIN GENERATED CODE - DO NOT MODIFY */") gen_server(tmpl) - print "/* END GENERATED CODE */" + print("/* END GENERATED CODE */") else: - print l[:-1] + print(l[:-1]) -- cgit