From 69b8ade6168d1b5a96323e3b656273375d2aff7b Mon Sep 17 00:00:00 2001 From: "Kaleb S. KEITHLEY" Date: Fri, 22 Jun 2018 06:19:53 -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/, https://review.gluster.org/#/c/20320/, and https://review.gluster.org/#/c/20332/ This patch fixes the remaining 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: If5aca67084a7b1c06966fed35fb35e8bb2f7d67c updates: #411 Signed-off-by: Kaleb S. KEITHLEY --- extras/create_new_xlator/generate_xlator.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'extras/create_new_xlator') diff --git a/extras/create_new_xlator/generate_xlator.py b/extras/create_new_xlator/generate_xlator.py index a0b1e691c17..0a54089080c 100755 --- a/extras/create_new_xlator/generate_xlator.py +++ b/extras/create_new_xlator/generate_xlator.py @@ -111,8 +111,8 @@ def gen_xlator(): print(" .{0:20} = {1}_{2},".format(dops, fop_prefix, dops), file=xl) print("};", file=xl) - xlator_methods = fragments["XLATOR_METHODS"].replace("@XL_NAME@",xl_name) - xlator_methods = xlator_methods.replace("@FOP_PREFIX@",fop_prefix) + xlator_methods = fragments["XLATOR_METHODS"].replace("@XL_NAME@", xl_name) + xlator_methods = xlator_methods.replace("@FOP_PREFIX@", fop_prefix) print(xlator_methods, file=xl) xl.close() @@ -155,7 +155,7 @@ def gen_makefiles(): m = open(src_dir_path+"/Makefile.am", 'w+') txt = MAKEFILE_FMT.replace("@XL_NAME@", xl_name) txt = txt.replace("@XL_NAME_NO_HYPHEN@", xl_name_no_hyphen) - txt = txt.replace("@XL_TYPE@",xlator_type) + txt = txt.replace("@XL_TYPE@", xlator_type) print(txt, file=m) m.close() @@ -170,7 +170,7 @@ def load_fragments (): result = {} basepath = os.path.abspath(os.path.dirname(__file__)) fragpath = basepath + "/new-xlator-tmpl.c" - for line in open(fragpath,"r").readlines(): + for line in open(fragpath, "r").readlines(): m = pragma_re.search(line) if m: if cur_symbol: -- cgit