diff --git a/bindings/python/libs/client/__init__.py b/bindings/python/libs/client/__init__.py index 8567684e3ec..10c6646fbfe 100644 --- a/bindings/python/libs/client/__init__.py +++ b/bindings/python/libs/client/__init__.py @@ -1,4 +1,6 @@ -from filesystem import FileSystem as FileSystem -from file import File as File -from url import URL as URL -from copyprocess import CopyProcess as CopyProcess +from __future__ import absolute_import, division, print_function + +from .filesystem import FileSystem as FileSystem +from .file import File as File +from .url import URL as URL +from .copyprocess import CopyProcess as CopyProcess diff --git a/bindings/python/libs/client/copyprocess.py b/bindings/python/libs/client/copyprocess.py index 7636c6e3e32..a34262d2b85 100644 --- a/bindings/python/libs/client/copyprocess.py +++ b/bindings/python/libs/client/copyprocess.py @@ -21,6 +21,7 @@ # granted to it by virtue of its status as an Intergovernmental Organization # or submit itself to any jurisdiction. #------------------------------------------------------------------------------- +from __future__ import absolute_import, division, print_function from pyxrootd import client from XRootD.client.url import URL @@ -37,7 +38,7 @@ def begin(self, jobId, total, source, target): self.handler.begin(jobId, total, URL(source), URL(target)) def end(self, jobId, results): - if results.has_key('status'): + if 'success' in results: results['status'] = XRootDStatus(results['status']) if self.handler: self.handler.end(jobId, results) @@ -134,6 +135,6 @@ def run(self, handler=None): """ status, results = self.__process.run(ProgressHandlerWrapper(handler)) for x in results: - if x.has_key('status'): + if 'status' in x: x['status'] = XRootDStatus(x['status']) return XRootDStatus(status), results diff --git a/bindings/python/libs/client/file.py b/bindings/python/libs/client/file.py index e593edcef9f..9cefc1d1c44 100644 --- a/bindings/python/libs/client/file.py +++ b/bindings/python/libs/client/file.py @@ -21,6 +21,7 @@ # granted to it by virtue of its status as an Intergovernmental Organization # or submit itself to any jurisdiction. #------------------------------------------------------------------------------- +from __future__ import absolute_import, division, print_function from pyxrootd import client from XRootD.client.responses import XRootDStatus, StatInfo, VectorReadInfo @@ -42,7 +43,7 @@ def __exit__(self, type, value, traceback): def __iter__(self): return self - def next(self): + def __next__(self): return self.__file.next() def open(self, url, flags=0, mode=0, timeout=0, callback=None): diff --git a/bindings/python/libs/client/filesystem.py b/bindings/python/libs/client/filesystem.py index fd0f0f31f72..5f9bb0b59c9 100644 --- a/bindings/python/libs/client/filesystem.py +++ b/bindings/python/libs/client/filesystem.py @@ -21,6 +21,7 @@ # granted to it by virtue of its status as an Intergovernmental Organization # or submit itself to any jurisdiction. #------------------------------------------------------------------------------- +from __future__ import absolute_import, division, print_function from pyxrootd import client from XRootD.client.responses import XRootDStatus, StatInfo, StatInfoVFS diff --git a/bindings/python/libs/client/flags.py b/bindings/python/libs/client/flags.py index d4852956fce..232edb0a0ca 100644 --- a/bindings/python/libs/client/flags.py +++ b/bindings/python/libs/client/flags.py @@ -15,10 +15,11 @@ # You should have received a copy of the GNU Lesser General Public License # along with XRootD. If not, see . #------------------------------------------------------------------------------- +from __future__ import absolute_import, division, print_function def enum(**enums): """Build the equivalent of a C++ enum""" - reverse = dict((value, key) for key, value in enums.iteritems()) + reverse = dict((value, key) for key, value in enums.items()) enums['reverse_mapping'] = reverse return type('Enum', (), enums) diff --git a/bindings/python/libs/client/responses.py b/bindings/python/libs/client/responses.py index 0da392834a6..c47863b8593 100644 --- a/bindings/python/libs/client/responses.py +++ b/bindings/python/libs/client/responses.py @@ -15,6 +15,8 @@ # You should have received a copy of the GNU Lesser General Public License # along with XRootD. If not, see . #------------------------------------------------------------------------------- +from __future__ import absolute_import, division, print_function + from XRootD.client.url import URL class Struct(object): @@ -23,7 +25,7 @@ def __init__(self, entries): self.__dict__.update(**entries) def __repr__(self): return '<%s>' % str(', '.join('%s: %s' % (k, repr(v)) - for (k, v) in self.__dict__.iteritems())) + for (k, v) in self.__dict__.items())) class LocationInfo(Struct): """Path location information (a list of discovered file locations). diff --git a/bindings/python/libs/client/url.py b/bindings/python/libs/client/url.py index 64fc0f29413..0a3fd249939 100644 --- a/bindings/python/libs/client/url.py +++ b/bindings/python/libs/client/url.py @@ -15,6 +15,7 @@ # You should have received a copy of the GNU Lesser General Public License # along with XRootD. If not, see . #------------------------------------------------------------------------------- +from __future__ import absolute_import, division, print_function from pyxrootd import client diff --git a/bindings/python/libs/client/utils.py b/bindings/python/libs/client/utils.py index acd10d32533..31ae0dbbeea 100644 --- a/bindings/python/libs/client/utils.py +++ b/bindings/python/libs/client/utils.py @@ -15,6 +15,7 @@ # You should have received a copy of the GNU Lesser General Public License # along with XRootD. If not, see . #------------------------------------------------------------------------------- +from __future__ import absolute_import, division, print_function from threading import Lock from XRootD.client.responses import XRootDStatus, HostList diff --git a/bindings/python/setup.py.in b/bindings/python/setup.py.in index f8ba79ca53e..457ce7bcf43 100644 --- a/bindings/python/setup.py.in +++ b/bindings/python/setup.py.in @@ -1,3 +1,5 @@ +from __future__ import print_function + from distutils.core import setup, Extension from distutils import sysconfig from os import getenv, walk, path @@ -25,10 +27,10 @@ xrdsrcincdir = "${XRD_SRCINCDIR}" xrdbinincdir = "${XRD_BININCDIR}" version = "${XROOTD_VERSION}" -print 'XRootD library dir: ', xrdlibdir -print 'XRootD src include dir:', xrdsrcincdir -print 'XRootD bin include dir:', xrdbinincdir -print 'Version: ', version +print('XRootD library dir: ', xrdlibdir) +print('XRootD src include dir:', xrdsrcincdir) +print('XRootD bin include dir:', xrdbinincdir) +print('Version: ', version) setup( name = 'pyxrootd', version = version,