diff options
author | Kaleb S. KEITHLEY <kkeithle@redhat.com> | 2018-06-07 12:27:23 -0400 |
---|---|---|
committer | Kaleb S. KEITHLEY <kkeithle@redhat.com> | 2018-06-07 12:37:43 -0400 |
commit | ee75c5abc41f43aa79b5e758e43f70a92672d3a2 (patch) | |
tree | 67433fa9021a2f85b861f8dbee0df3a46ae04e45 /xlators | |
parent | d788cc59b1cd4278ca0b8b2d9f6fe93f80550af3 (diff) |
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 <kkeithle@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/features/utime/src/utime-gen-fops-c.py | 23 | ||||
-rw-r--r-- | xlators/features/utime/src/utime-gen-fops-h.py | 9 |
2 files changed, 17 insertions, 15 deletions
diff --git a/xlators/features/utime/src/utime-gen-fops-c.py b/xlators/features/utime/src/utime-gen-fops-c.py index 4e22c2df0bc..5f4202f0d18 100644 --- a/xlators/features/utime/src/utime-gen-fops-c.py +++ b/xlators/features/utime/src/utime-gen-fops-c.py @@ -1,5 +1,6 @@ #!/usr/bin/python +from __future__ import print_function import os import sys @@ -97,22 +98,22 @@ utime_setattr_ops = ['setattr', 'fsetattr'] def gen_defaults(): for name in ops: if name in utime_ops: - print generate(FOPS_CBK_COMMON_TEMPLATE, name, cbk_subs) - print generate(FOPS_COMMON_TEMPLATE, name, fop_subs) + print(generate(FOPS_CBK_COMMON_TEMPLATE, name, cbk_subs)) + print(generate(FOPS_COMMON_TEMPLATE, name, fop_subs)) if name in utime_read_op: - print generate(FOPS_CBK_COMMON_TEMPLATE, name, cbk_subs) - print generate(FOPS_READ_TEMPLATE, name, fop_subs) + print(generate(FOPS_CBK_COMMON_TEMPLATE, name, cbk_subs)) + print(generate(FOPS_READ_TEMPLATE, name, fop_subs)) if name in utime_write_op: - print generate(FOPS_CBK_COMMON_TEMPLATE, name, cbk_subs) - print generate(FOPS_WRITE_TEMPLATE, name, fop_subs) + print(generate(FOPS_CBK_COMMON_TEMPLATE, name, cbk_subs)) + print(generate(FOPS_WRITE_TEMPLATE, name, fop_subs)) if name in utime_setattr_ops: - print generate(FOPS_CBK_COMMON_TEMPLATE, name, cbk_subs) - print generate(FOPS_SETATTR_TEMPLATE, name, fop_subs) + print(generate(FOPS_CBK_COMMON_TEMPLATE, name, cbk_subs)) + print(generate(FOPS_SETATTR_TEMPLATE, name, fop_subs)) for l in open(sys.argv[1], 'r').readlines(): if l.find('#pragma generate') != -1: - print "/* BEGIN GENERATED CODE - DO NOT MODIFY */" + print("/* BEGIN GENERATED CODE - DO NOT MODIFY */") gen_defaults() - print "/* END GENERATED CODE */" + print("/* END GENERATED CODE */") else: - print l[:-1] + print(l[:-1]) diff --git a/xlators/features/utime/src/utime-gen-fops-h.py b/xlators/features/utime/src/utime-gen-fops-h.py index 9f0270d5ae8..66119ce4fb2 100644 --- a/xlators/features/utime/src/utime-gen-fops-h.py +++ b/xlators/features/utime/src/utime-gen-fops-h.py @@ -1,5 +1,6 @@ #!/usr/bin/python +from __future__ import print_function import os import sys @@ -22,13 +23,13 @@ utime_ops = ['fallocate', 'zerofill', 'opendir', 'readlink', 'mknod', 'mkdir', def gen_defaults(): for name, value in ops.iteritems(): if name in utime_ops: - print generate(OP_FOP_TEMPLATE, name, fop_subs) + print(generate(OP_FOP_TEMPLATE, name, fop_subs)) for l in open(sys.argv[1], 'r').readlines(): if l.find('#pragma generate') != -1: - print "/* BEGIN GENERATED CODE - DO NOT MODIFY */" + print("/* BEGIN GENERATED CODE - DO NOT MODIFY */") gen_defaults() - print "/* END GENERATED CODE */" + print("/* END GENERATED CODE */") else: - print l[:-1] + print(l[:-1]) |