diff --git a/setup.py b/setup.py index beddbcfea5e675086633218632b09c906074216e..ba5d5b8f21b81d0b84e347e50d4586c3899cbca9 100644 --- a/setup.py +++ b/setup.py @@ -4,77 +4,17 @@ # Mon 16 Apr 08:18:08 2012 CEST from setuptools import setup, find_packages, dist -dist.Distribution(dict(setup_requires=['numpy', 'xbob.extension'])) -import numpy -from xbob.extension import Extension -from setuptools import setup, find_packages, dist -from distutils.extension import Extension -from distutils.version import LooseVersion - -dist.Distribution(dict(setup_requires=['pypkg', 'numpy', 'blitz.array'])) -import pypkg -import numpy -import blitz -import platform - -# Minimum version requirements for pkg-config packages -MINIMAL_BLITZ_VERSION_REQUIRED = '0.10' -MINIMAL_BOB_VERSION_REQUIRED = '1.3' - -# Pkg-config dependencies -blitz_pkg = pypkg.pkgconfig('blitz') -if blitz_pkg < MINIMAL_BLITZ_VERSION_REQUIRED: - raise RuntimeError("This package requires Blitz++ %s or superior, but you have %s" % (MINIMAL_BLITZ_VERSION_REQUIRED, blitz_pkg.version)) - -bob_pkg = pypkg.pkgconfig('bob-io') -if bob_pkg < MINIMAL_BOB_VERSION_REQUIRED: - raise RuntimeError("This package requires Bob %s or superior, but you have %s" % (MINIMAL_BOB_VERSION_REQUIRED, bob_pkg.version)) - -# Make-up the names of versioned Bob libraries we must link against -if platform.system() == 'Darwin': - bob_libraries=['%s.%s' % (k, bob_pkg.version) for k in bob_pkg.libraries()] -elif platform.system() == 'Linux': - bob_libraries=[':lib%s.so.%s' % (k, bob_pkg.version) for k in bob_pkg.libraries()] -else: - raise RuntimeError("This package currently only supports MacOSX and Linux builds") - -# Add system include directories -extra_compile_args = [] -system_includes = \ - [blitz.get_include()] + \ - blitz_pkg.include_directories() + \ - [numpy.get_include()] -for k in system_includes: extra_compile_args += ['-isystem', k] - -# NumPy API macros necessary? -define_macros=[ - ("PY_ARRAY_UNIQUE_SYMBOL", "XBOB_IO_PY_ARRAY_API"), - ("NO_IMPORT_ARRAY", "1"), - ] - -import numpy -from distutils.version import StrictVersion -if StrictVersion(numpy.__version__) >= StrictVersion('1.7'): - define_macros.append(("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")) - -# Compilation options -if platform.system() == 'Darwin': - extra_compile_args += ['-std=c++11', '-Wno-#warnings'] -else: - extra_compile_args += ['-std=c++11'] +dist.Distribution(dict(setup_requires=['xbob.blitz'])) +from xbob.blitz.extension import Extension -# Local include directory import os package_dir = os.path.dirname(os.path.realpath(__file__)) -package_base = os.path.join(package_dir, 'xbob', 'io') package_dir = os.path.join(package_dir, 'xbob', 'io', 'include') -include_dirs = [package_base, package_dir] +include_dirs = [package_dir] -# Define package version +packages = ['bob-io >= 1.3'] version = '2.0.0a0' -define_macros += [ - ("XBOB_IO_VERSION", version), - ] +define_macros = [("XBOB_IO_VERSION", '"%s"' % version)] setup( @@ -93,7 +33,7 @@ setup( install_requires=[ 'setuptools', - 'blitz.array', + 'xbob.blitz', ], namespace_packages=[ @@ -105,13 +45,9 @@ setup( [ "xbob/io/externals.cpp", ], - define_macros=define_macros, - include_dirs=include_dirs, - extra_compile_args=extra_compile_args, - library_dirs=bob_pkg.library_directories(), - runtime_library_dirs=bob_pkg.library_directories(), - libraries=bob_libraries, - language="c++", + packages = packages, + define_macros = define_macros, + include_dirs = include_dirs, ), Extension("xbob.io._library", [ @@ -122,13 +58,9 @@ setup( "xbob/io/hdf5.cpp", "xbob/io/main.cpp", ], - define_macros=define_macros, - include_dirs=include_dirs + bob_pkg.include_directories(), - extra_compile_args=extra_compile_args, - library_dirs=bob_pkg.library_directories(), - runtime_library_dirs=bob_pkg.library_directories(), - libraries=bob_libraries, - language="c++", + packages = packages, + define_macros = define_macros, + include_dirs = include_dirs, ), ], diff --git a/src/xbob.blitz b/src/xbob.blitz index 6162b2623dcee7b7570cd0462ed5baec20320162..3d4473033ba5304b1b8399019ad055abd3d1f057 160000 --- a/src/xbob.blitz +++ b/src/xbob.blitz @@ -1 +1 @@ -Subproject commit 6162b2623dcee7b7570cd0462ed5baec20320162 +Subproject commit 3d4473033ba5304b1b8399019ad055abd3d1f057 diff --git a/xbob/io/bobskin.cpp b/xbob/io/bobskin.cpp index ec3014719736e68e3107dc690f6b2ffb017b481d..603df51a8de4c49ef7d35af28a3c3a6ec48dde77 100644 --- a/xbob/io/bobskin.cpp +++ b/xbob/io/bobskin.cpp @@ -5,8 +5,8 @@ * @brief Implementation of our bobskin class */ -#include <bobskin.h> #include <stdexcept> +#include "bobskin.h" bobskin::bobskin(PyObject* array, bob::core::array::ElementType eltype) { diff --git a/xbob/io/bobskin.h b/xbob/io/bobskin.h index 8a9fe7bf7021ef10cc5c1eb108e4d04e8289c3d0..bdae7b62d145c4906127bfa81bec4284a97afd0f 100644 --- a/xbob/io/bobskin.h +++ b/xbob/io/bobskin.h @@ -10,7 +10,7 @@ extern "C" { #include <Python.h> -#include <blitz.array/capi.h> +#include <xbob.blitz/capi.h> } diff --git a/xbob/io/externals.cpp b/xbob/io/externals.cpp index 73fb7ceccc78081d368a9bd87bb50c35ea071277..af243818d4a05d9c491d9967315faf39d523eda9 100644 --- a/xbob/io/externals.cpp +++ b/xbob/io/externals.cpp @@ -950,7 +950,7 @@ PyMODINIT_FUNC ENTRY_FUNCTION(XBOB_IO_VERSIONS_MODULE_NAME) (void) { /* register some constants */ PyModule_AddIntConstant(m, "__api_version__", XBOB_IO_API_VERSION); - PyModule_AddStringConstant(m, "__version__", BOOST_PP_STRINGIZE(XBOB_IO_VERSION)); + PyModule_AddStringConstant(m, "__version__", XBOB_IO_VERSION); PyModule_AddObject(m, "versions", build_version_dictionary()); /* imports the NumPy C-API */ diff --git a/xbob/io/file.cpp b/xbob/io/file.cpp index 867d5be82ba16a8cd2c071ed7e2086b0e8fa8dcd..21b47e7f8cd754d8a2f0194b447c1e0cf5892d3b 100644 --- a/xbob/io/file.cpp +++ b/xbob/io/file.cpp @@ -10,9 +10,9 @@ #include <bob/io/CodecRegistry.h> #include <bob/io/utils.h> #include <numpy/arrayobject.h> -#include <blitz.array/capi.h> +#include <xbob.blitz/capi.h> #include <stdexcept> -#include <bobskin.h> +#include "bobskin.h" #define FILETYPE_NAME File PyDoc_STRVAR(s_file_str, BOOST_PP_STRINGIZE(XBOB_IO_MODULE_PREFIX) "." BOOST_PP_STRINGIZE(FILETYPE_NAME)); @@ -443,10 +443,10 @@ Parameters:\n\ \n\ array\n\ [array] The array to be written into the file. It can be a\n\ - numpy, a blitz array or any other object which can be\n\ + numpy, a xbob.blitz.array or any other object which can be\n\ converted to either of them, as long as the number of\n\ dimensions and scalar type are supported by\n\ - :py:class:`blitz.array`.\n\ + :py:class:`xbob.blitz.array`.\n\ \n\ This method writes data to the file. It acts like the\n\ given array is the only piece of data that will ever be written\n\ @@ -496,10 +496,10 @@ Parameters:\n\ \n\ array\n\ [array] The array to be added into the file. It can be a\n\ - numpy, a blitz array or any other object which can be\n\ + numpy, a xbob.blitz.array or any other object which can be\n\ converted to either of them, as long as the number of\n\ dimensions and scalar type are supported by\n\ - :py:class:`blitz.array`.\n\ + :py:class:`xbob.blitz.array`.\n\ \n\ This method appends data to the file. If the file does not\n\ exist, creates a new file, else, makes sure that the inserted\n\ diff --git a/xbob/io/hdf5.cpp b/xbob/io/hdf5.cpp index 0deb128834c7c3657c9edc34fe38302182ccd94f..82fe45941f3575f9dc722b6aea5058020a63f885 100644 --- a/xbob/io/hdf5.cpp +++ b/xbob/io/hdf5.cpp @@ -10,9 +10,9 @@ #include <boost/make_shared.hpp> #include <numpy/arrayobject.h> -#include <blitz.array/cppapi.h> +#include <xbob.blitz/cppapi.h> #include <stdexcept> -#include <bobskin.h> +#include "bobskin.h" #define HDF5FILE_NAME HDF5File PyDoc_STRVAR(s_hdf5file_str, BOOST_PP_STRINGIZE(XBOB_IO_MODULE_PREFIX) "." BOOST_PP_STRINGIZE(HDF5FILE_NAME)); @@ -890,7 +890,7 @@ static bool PyBobIoHDF5File_IsPythonScalar(PyObject* obj) { /** * Returns the type of object `op' is - a scalar (return value = 0), a - * blitz.array (return value = 1), a numpy.ndarray (return value = 2), an + * xbob.blitzarray (return value = 1), a numpy.ndarray (return value = 2), an * object which is convertible to a numpy.ndarray (return value = 3) or returns * -1 if the object cannot be converted. No error is set on the python stack. * @@ -1118,7 +1118,7 @@ static PyObject* PyBobIoHDF5File_Replace(PyBobIoHDF5FileObject* self, PyObject* else { //write as array switch (is_array) { - case 1: //blitz.array + case 1: //xbob.blitz.array self->f->write_buffer(path, pos, type, ((PyBlitzArrayObject*)data)->data); break; @@ -1252,7 +1252,7 @@ static int PyBobIoHDF5File_InnerAppend(PyBobIoHDF5FileObject* self, const char* else { //write as array switch (is_array) { - case 1: //blitz.array + case 1: //xbob.blitz.array if (!self->f->contains(path)) self->f->create(path, type, true, compression); self->f->extend_buffer(path, type, ((PyBlitzArrayObject*)data)->data); break; @@ -1445,7 +1445,7 @@ static PyObject* PyBobIoHDF5File_Set(PyBobIoHDF5FileObject* self, PyObject* args else { //write as array switch (is_array) { - case 1: //blitz.array + case 1: //xbob.blitz.array if (!self->f->contains(path)) self->f->create(path, type, false, compression); self->f->write_buffer(path, 0, type, ((PyBlitzArrayObject*)data)->data); break; @@ -1873,7 +1873,7 @@ static PyObject* PyBobIoHDF5File_WriteAttribute(PyBobIoHDF5FileObject* self, try { switch (is_array) { - case 1: //blitz.array + case 1: //xbob.blitz.array self->f->write_attribute(path, name, type, ((PyBlitzArrayObject*)o)->data); break; diff --git a/xbob/io/main.cpp b/xbob/io/main.cpp index 8a061d518072ea5a23d72f6394870c038714fb86..31064f6cbd743f70c18a7c11709fc59636d53c9e 100644 --- a/xbob/io/main.cpp +++ b/xbob/io/main.cpp @@ -11,7 +11,7 @@ #ifdef NO_IMPORT_ARRAY #undef NO_IMPORT_ARRAY #endif -#include <blitz.array/capi.h> +#include <xbob.blitz/capi.h> static PyMethodDef module_methods[] = { {0} /* Sentinel */ @@ -51,7 +51,7 @@ PyMODINIT_FUNC ENTRY_FUNCTION(XBOB_IO_MODULE_NAME) (void) { /* register some constants */ PyModule_AddIntConstant(m, "__api_version__", XBOB_IO_API_VERSION); - PyModule_AddStringConstant(m, "__version__", BOOST_PP_STRINGIZE(XBOB_IO_VERSION)); + PyModule_AddStringConstant(m, "__version__", XBOB_IO_VERSION); /* register the types to python */ Py_INCREF(&PyBobIoFile_Type); @@ -125,7 +125,7 @@ PyMODINIT_FUNC ENTRY_FUNCTION(XBOB_IO_MODULE_NAME) (void) { /* imports the NumPy C-API */ import_array(); - /* imports blitz.array C-API */ - import_blitz_array(); + /* imports xbob.blitz C-API */ + import_xbob_blitz(); } diff --git a/xbob/io/videoreader.cpp b/xbob/io/videoreader.cpp index 42c5bbd2e6468605cf19a9c192589a18b315f228..0390aa5e060252387673e2ef8366e64351559440 100644 --- a/xbob/io/videoreader.cpp +++ b/xbob/io/videoreader.cpp @@ -11,9 +11,9 @@ #if WITH_FFMPEG #include <boost/make_shared.hpp> #include <numpy/arrayobject.h> -#include <blitz.array/capi.h> +#include <xbob.blitz/capi.h> #include <stdexcept> -#include <bobskin.h> +#include "bobskin.h" #define VIDEOREADER_NAME VideoReader PyDoc_STRVAR(s_videoreader_str, BOOST_PP_STRINGIZE(XBOB_IO_MODULE_PREFIX) "." BOOST_PP_STRINGIZE(VIDEOREADER_NAME)); diff --git a/xbob/io/videowriter.cpp b/xbob/io/videowriter.cpp index a7122ef4c84173929afec420aafe5a0a2e594537..94ea02e41e2c966de8afa494283d3b84b9d9eeb2 100644 --- a/xbob/io/videowriter.cpp +++ b/xbob/io/videowriter.cpp @@ -11,9 +11,9 @@ #if WITH_FFMPEG #include <boost/make_shared.hpp> #include <numpy/arrayobject.h> -#include <blitz.array/cppapi.h> +#include <xbob.blitz/cppapi.h> #include <stdexcept> -#include <bobskin.h> +#include "bobskin.h" #define VIDEOWRITER_NAME VideoWriter PyDoc_STRVAR(s_videowriter_str, BOOST_PP_STRINGIZE(XBOB_IO_MODULE_PREFIX) "." BOOST_PP_STRINGIZE(VIDEOWRITER_NAME));