From 4b7707382bc763f089e14334c2b7f3139e186c1f Mon Sep 17 00:00:00 2001 From: "Kaleb S. KEITHLEY" Date: Wed, 20 Jun 2018 11:38:59 -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/, https://review.gluster.org/#/c/20227/, https://review.gluster.org/#/c/20307/, and https://review.gluster.org/#/c/20320/ This patch fixes more selected comma white space (ws_comma) as suggested by the 2to3 utility. (Earlier attempts to fix all ws_comma in one patch did not pass centos regression, hence multiple patches to identify the change that causes the failure.) Note: Fedora packaging guidelines and SUSE rpmlint require explicit shebangs; popular practices like #!/usr/bin/env python and #!/usr/bin/python are not allowed; they must be #!/usr/bin/python2 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: I6e5a2408fa1fc81e00e66d6e4a7f9f6fa1d1ed15 updates: #411 Signed-off-by: Kaleb S. KEITHLEY --- xlators/experimental/fdl/src/gen_fdl.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'xlators') diff --git a/xlators/experimental/fdl/src/gen_fdl.py b/xlators/experimental/fdl/src/gen_fdl.py index d2e7dd5dfb2..e8f97dc9957 100755 --- a/xlators/experimental/fdl/src/gen_fdl.py +++ b/xlators/experimental/fdl/src/gen_fdl.py @@ -289,16 +289,16 @@ def get_special_subs (args): if arg[3] == "vector": # Make it as obvious as possible that this is a special case. len_code += LEN_VECTOR_TEMPLATE \ - .replace("@VEC@","stub->args.vector") \ - .replace("@CNT@","stub->args.count") + .replace("@VEC@", "stub->args.vector") \ + .replace("@CNT@", "stub->args.count") ser_code += SERLZ_VECTOR_TEMPLATE \ - .replace("@VEC@","stub->args.vector") \ - .replace("@CNT@","stub->args.count") + .replace("@VEC@", "stub->args.vector") \ + .replace("@CNT@", "stub->args.count") else: len_tmpl, ser_tmpl = typemap[arg[2]] src = "stub->args.%s" % arg[3] - len_code += len_tmpl.replace("@SRC@",src) - ser_code += ser_tmpl.replace("@SRC@",src) + len_code += len_tmpl.replace("@SRC@", src) + ser_code += ser_tmpl.replace("@SRC@", src) return len_code, ser_code # Mention those fops in the selective_generate table, for which @@ -326,17 +326,17 @@ def gen_fdl (): fop_subs[name]["@LEN_CODE@"] = len_code[:-1] fop_subs[name]["@SER_CODE@"] = ser_code[:-1] if 'len' in gen_funcs: - print(generate(LEN_TEMPLATE,name,fop_subs)) + print(generate(LEN_TEMPLATE, name, fop_subs)) if 'serialize' in gen_funcs: - print(generate(SER_TEMPLATE,name,fop_subs)) + print(generate(SER_TEMPLATE, name, fop_subs)) if name == 'writev': print("#define DESTAGE_ASYNC") if 'callback' in gen_funcs: - print(generate(CBK_TEMPLATE,name,cbk_subs)) + print(generate(CBK_TEMPLATE, name, cbk_subs)) if 'continue' in gen_funcs: - print(generate(CONTINUE_TEMPLATE,name,fop_subs)) + print(generate(CONTINUE_TEMPLATE, name, fop_subs)) if 'fop' in gen_funcs: - print(generate(FOP_TEMPLATE,name,fop_subs)) + print(generate(FOP_TEMPLATE, name, fop_subs)) if name == 'writev': print("#undef DESTAGE_ASYNC") entrypoints.append(name) @@ -345,7 +345,7 @@ def gen_fdl (): print("\t.%s = fdl_%s," % (ep, ep)) print("};") -for l in open(sys.argv[1],'r').readlines(): +for l in open(sys.argv[1], 'r').readlines(): if l.find('#pragma generate') != -1: print("/* BEGIN GENERATED CODE - DO NOT MODIFY */") gen_fdl() -- cgit