From ee75c5abc41f43aa79b5e758e43f70a92672d3a2 Mon Sep 17 00:00:00 2001 From: "Kaleb S. KEITHLEY" Date: Thu, 7 Jun 2018 12:27:23 -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/, and https://review.gluster.org/#/c/20104/ https://review.gluster.org/#/c/20162/ This patch changes uses of map() and raise(), and a few cases of print() that were overlooked in the prior patch that fixed print. Note: Fedora packaging guidelines require explicit shebangs, so 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, idioms, numliterals, set_literal, types, urllib, zip, map, and raise 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, intern, itertools, metaclass, methodattrs, ne, next, nonzero, operator, paren, raw_input, reduce, reload, renames, repr, standarderror, sys_exc, throw, tuple_params, xreadlines. Change-Id: Id62ea491e4ab5dd390075c5c6d9d889cf6f9da27 updates: #411 Signed-off-by: Kaleb S. KEITHLEY --- extras/create_new_xlator/generate_xlator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 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 1647efa2618..a0b1e691c17 100755 --- a/extras/create_new_xlator/generate_xlator.py +++ b/extras/create_new_xlator/generate_xlator.py @@ -38,7 +38,7 @@ def get_param(names, types): # Convert two separate tuples to one of (name, type) sub-tuples. as_tuples = list(zip(types, names)) # Convert each sub-tuple into a "type name" string. - as_strings = map(string.join, as_tuples) + as_strings = list(map(string.join, as_tuples)) # Join all of those into one big string. return string.join(as_strings, ",\n\t") @@ -58,7 +58,7 @@ def generate(tmpl, name, table): #Args are (var1, var2,...) sdict["@WIND_ARGS@"] = string.join(w_arg_names, ", ") sdict["@UNWIND_ARGS@"] = string.join(u_arg_names, ", ") - sdict["@ERROR_ARGS@"] = string.join(map(get_error_arg, u_arg_types), ", ") + sdict["@ERROR_ARGS@"] = string.join(list(map(get_error_arg, u_arg_types)), ", ") sdict["@WIND_PARAMS@"] = get_param(w_arg_names, w_arg_types) sdict["@UNWIND_PARAMS@"] = get_param(u_arg_names, u_arg_types) sdict["@FUNC_PARAMS@"] = get_param(fn_arg_names, fn_arg_types) -- cgit