Skip to content

Commit

Permalink
Merge branch 'master' into xrdssiV2
Browse files Browse the repository at this point in the history
Conflicts:
	src/XrdPlugins.cmake
  • Loading branch information
abh3 committed Jul 13, 2017
2 parents c42aab7 + 1d4dd3e commit 1c45a9a
Show file tree
Hide file tree
Showing 134 changed files with 4,115 additions and 3,421 deletions.
12 changes: 9 additions & 3 deletions .travis.yml
@@ -1,4 +1,5 @@
sudo: false
dist: trusty
addons:
apt:
packages:
Expand All @@ -9,8 +10,13 @@ compiler:
- clang
- gcc
script:
- mkdir build && cd build
- cmake -DENABLE_TESTS=1 ..
- mkdir build
- pushd build
- cmake -DCMAKE_INSTALL_PREFIX=$HOME/xrootd -DENABLE_TESTS=1 ..
- make
- make test
- make install
- popd
after_script:
- pushd build
- ./tests/common/text-runner ./tests/XrdClTests/libXrdClTests.so 'All Tests'
- popd
10 changes: 6 additions & 4 deletions 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
5 changes: 3 additions & 2 deletions bindings/python/libs/client/copyprocess.py
Expand Up @@ -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
Expand All @@ -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 'status' in results:
results['status'] = XRootDStatus(results['status'])
if self.handler:
self.handler.end(jobId, results)
Expand Down Expand Up @@ -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
6 changes: 5 additions & 1 deletion bindings/python/libs/client/file.py
Expand Up @@ -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
Expand All @@ -42,9 +43,12 @@ def __exit__(self, type, value, traceback):
def __iter__(self):
return self

def next(self):
def __next__(self):
return self.__file.next()

# Python 2 compatibility
next = __next__

def open(self, url, flags=0, mode=0, timeout=0, callback=None):
"""Open the file pointed to by the given URL.
Expand Down
1 change: 1 addition & 0 deletions bindings/python/libs/client/filesystem.py
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion bindings/python/libs/client/flags.py
Expand Up @@ -15,10 +15,11 @@
# You should have received a copy of the GNU Lesser General Public License
# along with XRootD. If not, see <http:#www.gnu.org/licenses/>.
#-------------------------------------------------------------------------------
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)

Expand Down
4 changes: 3 additions & 1 deletion bindings/python/libs/client/responses.py
Expand Up @@ -15,6 +15,8 @@
# You should have received a copy of the GNU Lesser General Public License
# along with XRootD. If not, see <http:#www.gnu.org/licenses/>.
#-------------------------------------------------------------------------------
from __future__ import absolute_import, division, print_function

from XRootD.client.url import URL

class Struct(object):
Expand All @@ -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).
Expand Down
1 change: 1 addition & 0 deletions bindings/python/libs/client/url.py
Expand Up @@ -15,6 +15,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with XRootD. If not, see <http:#www.gnu.org/licenses/>.
#-------------------------------------------------------------------------------
from __future__ import absolute_import, division, print_function

from pyxrootd import client

Expand Down
1 change: 1 addition & 0 deletions bindings/python/libs/client/utils.py
Expand Up @@ -15,6 +15,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with XRootD. If not, see <http:#www.gnu.org/licenses/>.
#-------------------------------------------------------------------------------
from __future__ import absolute_import, division, print_function

from threading import Lock
from XRootD.client.responses import XRootDStatus, HostList
Expand Down
10 changes: 6 additions & 4 deletions 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
Expand Down Expand Up @@ -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,
Expand Down
7 changes: 3 additions & 4 deletions bindings/python/src/ChunkIterator.hh
Expand Up @@ -98,8 +98,8 @@ namespace PyXRootD

else {
self->currentOffset += self->chunksize;
pychunk = PyString_FromStringAndSize( (const char*) chunk->GetBuffer(),
chunk->GetSize() );
pychunk = PyBytes_FromStringAndSize( (const char*) chunk->GetBuffer(),
chunk->GetSize() );
}

delete chunk;
Expand All @@ -110,8 +110,7 @@ namespace PyXRootD
//! ChunkIterator type structure
//----------------------------------------------------------------------------
static PyTypeObject ChunkIteratorType = {
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
PyVarObject_HEAD_INIT(NULL, 0)
"client.File.ChunkIterator", /* tp_name */
sizeof(ChunkIterator), /* tp_basicsize */
0, /* tp_itemsize */
Expand Down
22 changes: 16 additions & 6 deletions bindings/python/src/PyXRootD.hh
Expand Up @@ -25,21 +25,31 @@
#ifndef PYXROOTD_HH_
#define PYXROOTD_HH_

#if PY_MAJOR_VERSION >= 3
#define IS_PY3K
#endif

#include <Python.h>
#include <string>
#include "structmember.h"

#if PY_MINOR_VERSION <= 5
#define PyUnicode_FromString PyString_FromString
#if PY_MAJOR_VERSION >= 3
#define IS_PY3K
#endif

#define async( func ) \
Py_BEGIN_ALLOW_THREADS \
func; \
Py_END_ALLOW_THREADS \

#ifdef IS_PY3K
#define Py_TPFLAGS_HAVE_ITER 0
/* TODO don't use this hack */
#define METH_KEYWORDS 0x0003
#else
#if PY_MINOR_VERSION <= 5
#define PyUnicode_FromString PyString_FromString
#endif
#define PyBytes_Size PyString_Size
#define PyBytes_Check PyString_Check
#define PyBytes_FromString PyString_FromString
#define PyBytes_FromStringAndSize PyString_FromStringAndSize
#endif

#endif /* PYXROOTD_HH_ */
5 changes: 2 additions & 3 deletions bindings/python/src/PyXRootDCopyProcess.hh
Expand Up @@ -67,7 +67,7 @@ namespace PyXRootD
{
delete self->process;
delete self->results;
self->ob_type->tp_free( (PyObject*) self );
Py_TYPE(self)->tp_free( (PyObject*) self );
}

//----------------------------------------------------------------------------
Expand Down Expand Up @@ -97,8 +97,7 @@ namespace PyXRootD
//! CopyProcess binding type object
//----------------------------------------------------------------------------
static PyTypeObject CopyProcessType = {
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
PyVarObject_HEAD_INIT(NULL, 0)
"pyxrootd.CopyProcess", /* tp_name */
sizeof(CopyProcess), /* tp_basicsize */
0, /* tp_itemsize */
Expand Down
6 changes: 3 additions & 3 deletions bindings/python/src/PyXRootDFile.cc
Expand Up @@ -295,10 +295,10 @@ namespace PyXRootD
if ( off_init == 0 )
self->currentOffset += line->GetSize();

pyline = PyString_FromStringAndSize( line->GetBuffer(), line->GetSize() );
pyline = PyBytes_FromStringAndSize( line->GetBuffer(), line->GetSize() );
}
else
pyline = PyString_FromString( "" );
pyline = PyBytes_FromString( "" );

delete line;
delete chunk;
Expand Down Expand Up @@ -346,7 +346,7 @@ namespace PyXRootD
{
line = self->ReadLine( self, args, kwds );

if ( !line || PyString_Size( line ) == 0 )
if ( !line || PyBytes_Size( line ) == 0 )
break;

PyList_Append( lines, line );
Expand Down
7 changes: 3 additions & 4 deletions bindings/python/src/PyXRootDFile.hh
Expand Up @@ -91,7 +91,7 @@ namespace PyXRootD
static void File_dealloc( File *self )
{
delete self->file;
self->ob_type->tp_free( (PyObject*) self );
Py_TYPE(self)->tp_free( (PyObject*) self );
}

//----------------------------------------------------------------------------
Expand Down Expand Up @@ -121,7 +121,7 @@ namespace PyXRootD
//--------------------------------------------------------------------------
// Raise StopIteration if the line we just read is empty
//--------------------------------------------------------------------------
if ( PyString_Size( line ) == 0 ) {
if ( PyBytes_Size( line ) == 0 ) {
PyErr_SetNone( PyExc_StopIteration );
return NULL;
}
Expand Down Expand Up @@ -207,8 +207,7 @@ namespace PyXRootD
//! File binding type object
//----------------------------------------------------------------------------
static PyTypeObject FileType = {
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
PyVarObject_HEAD_INIT(NULL, 0)
"pyxrootd.File", /* tp_name */
sizeof(File), /* tp_basicsize */
0, /* tp_itemsize */
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/src/PyXRootDFileSystem.cc
Expand Up @@ -624,7 +624,7 @@ namespace PyXRootD
for ( int i = 0; i < PyList_Size( pyfiles ); ++i ) {
pyfile = PyList_GetItem( pyfiles, i );
if ( !pyfile ) return NULL;
file = PyString_AsString( pyfile );
file = PyBytes_AsString( pyfile );
files.push_back( std::string( file ) );
}

Expand Down
4 changes: 2 additions & 2 deletions bindings/python/src/PyXRootDFileSystem.hh
Expand Up @@ -134,7 +134,7 @@ namespace PyXRootD
{
delete self->filesystem;
Py_XDECREF( self->url );
self->ob_type->tp_free( (PyObject*) self );
Py_TYPE(self)->tp_free( (PyObject*) self );
}

//----------------------------------------------------------------------------
Expand All @@ -151,7 +151,7 @@ namespace PyXRootD
//! FileSystem binding type object
//----------------------------------------------------------------------------
static PyTypeObject FileSystemType =
{ PyObject_HEAD_INIT(NULL) 0, /* ob_size */
{ PyVarObject_HEAD_INIT(NULL, 0)
"pyxrootd.FileSystem", /* tp_name */
sizeof(FileSystem), /* tp_basicsize */
0, /* tp_itemsize */
Expand Down

0 comments on commit 1c45a9a

Please sign in to comment.