diff options
author | Kaleb S. KEITHLEY <kkeithle@redhat.com> | 2018-04-13 09:13:16 -0400 |
---|---|---|
committer | Kaleb KEITHLEY <kkeithle@redhat.com> | 2018-05-02 11:28:46 +0000 |
commit | 4e7b423d3c3137c3f83b71b36279e1a544154833 (patch) | |
tree | e59dc57aa319a5e145161a0e32fba9fc74773e91 /tests/utils/getfattr.py | |
parent | 9da91172538a2a95fba609c93e199db159fd1938 (diff) |
core/various: python3 compat, prepare for python2 -> python3
see https://review.gluster.org/#/c/19788/
use print fn from __future__
Change-Id: If5075d8d9ca9641058fbc71df8a52aa35804cda4
updates: #411
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Diffstat (limited to 'tests/utils/getfattr.py')
-rwxr-xr-x | tests/utils/getfattr.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/tests/utils/getfattr.py b/tests/utils/getfattr.py index 6636644f67c..7d1f7368e3e 100755 --- a/tests/utils/getfattr.py +++ b/tests/utils/getfattr.py @@ -1,5 +1,6 @@ #!/usr/bin/python2 +from __future__ import print_function import os import sys from optparse import OptionParser @@ -32,22 +33,22 @@ def getfattr(path, option): def print_getfattr (path, option, encoded_attr=None): if encoded_attr: if option.encoding == "hex": - print ("%s=0x%s" % (option.name, encoded_attr)) + print(("%s=0x%s" % (option.name, encoded_attr))) elif option.encoding == "base64": - print ("%s=0s%s" % (option.name, encoded_attr)) + print(("%s=0s%s" % (option.name, encoded_attr))) else: - print ("%s=\"%s\"" % (option.name, encoded_attr)) + print(("%s=\"%s\"" % (option.name, encoded_attr))) else: - print option.name + print(option.name) return def print_header (path, absnames): if absnames: - print ("# file: %s" % path) + print(("# file: %s" % path)) else: print ("getfattr: Removing leading '/' from absolute path names") - print ("# file: %s" % path[1:]) + print(("# file: %s" % path[1:])) if __name__ == '__main__': usage = "usage: %prog [-n name|-d] [-e en] [-m pattern] path...." @@ -99,8 +100,8 @@ if __name__ == '__main__': if (not (option.encoding.strip() == "hex" or option.encoding.strip() == "base64" or option.encoding.strip() == "text")): - print ("unrecognized encoding parameter... %s, please use" - " `text`, `base64` or `hex`" % option.encoding) + print(("unrecognized encoding parameter... %s, please use" + " `text`, `base64` or `hex`" % option.encoding)) sys.exit(1) args[0] = os.path.abspath(args[0]) @@ -110,7 +111,7 @@ if __name__ == '__main__': try: getfattr(args[0], option) except KeyError as err: - print ("Invalid key %s" % err) + print(("Invalid key %s" % err)) sys.exit(1) except IOError as err: print (err) |