From f816a6e838f8c52f1b8317ae6f1a4103f9267ba6 Mon Sep 17 00:00:00 2001 From: "Kaleb S. KEITHLEY" Date: Mon, 18 Jun 2018 09:17:26 -0400 Subject: core/various: python3 compat, prepare for python2 -> python3 see https://review.gluster.org/#/c/19788/, https://review.gluster.org/#/c/19871/, https://review.gluster.org/#/c/19952/, https://review.gluster.org/#/c/20104/, https://review.gluster.org/#/c/20162/, https://review.gluster.org/#/c/20185/, https://review.gluster.org/#/c/20207/, and https://review.gluster.org/#/c/20227/ This patch fixes selected comma white space (ws_comma) as suggested by the 2to3 utility. Note: Fedora packaging guidelines and SUSE rpmlint require explicit shebangs, so popular practices like #!/usr/bin/env python and or #!/usr/bin/python3 Note: Selected small fixes from 2to3 utility. Specifically apply, basestring, funcattrs, has_key, idioms, map, numliterals, raise, set_literal, types, urllib, and zip have already been applied. Also version agnostic imports for urllib, cpickle, socketserver, _thread, queue, etc., suggested by Aravinda in https://review.gluster.org/#/c/19767/1 Note: these 2to3 fixes report no changes are necessary: asserts, buffer, exec, execfile, exitfunc, filter, getcwdu, imports2, input, intern, itertools, metaclass, methodattrs, ne, next, nonzero, operator, paren, raw_input, reduce, reload, renames, repr, standarderror, sys_exc, throw, tuple_params, xreadlines. Change-Id: I691d7f86279572642902650ed1c24840e3c4b781 Updates: #411 Signed-off-by: Kaleb S. KEITHLEY --- xlators/experimental/jbr-server/src/gen-fops.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 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 e728f473372..c4c87556cb3 100755 --- a/xlators/experimental/jbr-server/src/gen-fops.py +++ b/xlators/experimental/jbr-server/src/gen-fops.py @@ -12,7 +12,7 @@ import string import sys curdir = os.path.dirname(sys.argv[0]) -gendir = os.path.join(curdir,'../../../../libglusterfs/src') +gendir = os.path.join(curdir, '../../../../libglusterfs/src') sys.path.append(gendir) from generator import ops, fop_subs, cbk_subs, generate @@ -28,19 +28,19 @@ def load_templates (path): tmpl_re = re.compile("/\* template-name (.*) \*/") templates = {} t_name = None - for line in open(path,"r").readlines(): + for line in open(path, "r").readlines(): if not line: break m = tmpl_re.match(line) if m: if t_name: - templates[t_name] = string.join(t_contents,'') + templates[t_name] = string.join(t_contents, '') t_name = m.group(1).strip() t_contents = [] elif t_name: t_contents.append(line) if t_name: - templates[t_name] = string.join(t_contents,'') + templates[t_name] = string.join(t_contents, '') return templates # We need two types of templates. The first, for pure read operations, just @@ -137,30 +137,30 @@ def gen_server (templates): if 'complete' in gen_funcs: print(generate(templates[kind+"-complete"], - name,cbk_subs)) + name, cbk_subs)) if 'continue' in gen_funcs: print(generate(templates[kind+"-continue"], - name,fop_subs)) + name, fop_subs)) if 'fan-in' in gen_funcs: print(generate(templates[kind+"-fan-in"], - name,cbk_subs)) + name, cbk_subs)) if 'dispatch' in gen_funcs: print(generate(templates[kind+"-dispatch"], - name,fop_subs)) + name, fop_subs)) if 'call_dispatch' in gen_funcs: print(generate(templates[kind+"-call_dispatch"], - name,fop_subs)) + name, fop_subs)) if 'perform_local_op' in gen_funcs: 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()) @@ -168,11 +168,11 @@ def gen_server (templates): # 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(): +for l in open(sys.argv[2], 'r').readlines(): if l.find('#pragma generate') != -1: print("/* BEGIN GENERATED CODE - DO NOT MODIFY */") gen_server(tmpl) -- cgit