Skip to content
Snippets Groups Projects
Commit 9a397e51 authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

Depends on xbob.blitz for config

parent c5cca254
No related branches found
No related tags found
No related merge requests found
...@@ -4,77 +4,17 @@ ...@@ -4,77 +4,17 @@
# Mon 16 Apr 08:18:08 2012 CEST # Mon 16 Apr 08:18:08 2012 CEST
from setuptools import setup, find_packages, dist from setuptools import setup, find_packages, dist
dist.Distribution(dict(setup_requires=['numpy', 'xbob.extension'])) dist.Distribution(dict(setup_requires=['xbob.blitz']))
import numpy from xbob.blitz.extension import Extension
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']
# Local include directory
import os import os
package_dir = os.path.dirname(os.path.realpath(__file__)) 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') 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' version = '2.0.0a0'
define_macros += [ define_macros = [("XBOB_IO_VERSION", '"%s"' % version)]
("XBOB_IO_VERSION", version),
]
setup( setup(
...@@ -93,7 +33,7 @@ setup( ...@@ -93,7 +33,7 @@ setup(
install_requires=[ install_requires=[
'setuptools', 'setuptools',
'blitz.array', 'xbob.blitz',
], ],
namespace_packages=[ namespace_packages=[
...@@ -105,13 +45,9 @@ setup( ...@@ -105,13 +45,9 @@ setup(
[ [
"xbob/io/externals.cpp", "xbob/io/externals.cpp",
], ],
define_macros=define_macros, packages = packages,
include_dirs=include_dirs, define_macros = define_macros,
extra_compile_args=extra_compile_args, include_dirs = include_dirs,
library_dirs=bob_pkg.library_directories(),
runtime_library_dirs=bob_pkg.library_directories(),
libraries=bob_libraries,
language="c++",
), ),
Extension("xbob.io._library", Extension("xbob.io._library",
[ [
...@@ -122,13 +58,9 @@ setup( ...@@ -122,13 +58,9 @@ setup(
"xbob/io/hdf5.cpp", "xbob/io/hdf5.cpp",
"xbob/io/main.cpp", "xbob/io/main.cpp",
], ],
define_macros=define_macros, packages = packages,
include_dirs=include_dirs + bob_pkg.include_directories(), define_macros = define_macros,
extra_compile_args=extra_compile_args, include_dirs = include_dirs,
library_dirs=bob_pkg.library_directories(),
runtime_library_dirs=bob_pkg.library_directories(),
libraries=bob_libraries,
language="c++",
), ),
], ],
......
Subproject commit 6162b2623dcee7b7570cd0462ed5baec20320162 Subproject commit 3d4473033ba5304b1b8399019ad055abd3d1f057
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
* @brief Implementation of our bobskin class * @brief Implementation of our bobskin class
*/ */
#include <bobskin.h>
#include <stdexcept> #include <stdexcept>
#include "bobskin.h"
bobskin::bobskin(PyObject* array, bob::core::array::ElementType eltype) { bobskin::bobskin(PyObject* array, bob::core::array::ElementType eltype) {
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
extern "C" { extern "C" {
#include <Python.h> #include <Python.h>
#include <blitz.array/capi.h> #include <xbob.blitz/capi.h>
} }
......
...@@ -950,7 +950,7 @@ PyMODINIT_FUNC ENTRY_FUNCTION(XBOB_IO_VERSIONS_MODULE_NAME) (void) { ...@@ -950,7 +950,7 @@ PyMODINIT_FUNC ENTRY_FUNCTION(XBOB_IO_VERSIONS_MODULE_NAME) (void) {
/* register some constants */ /* register some constants */
PyModule_AddIntConstant(m, "__api_version__", XBOB_IO_API_VERSION); 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()); PyModule_AddObject(m, "versions", build_version_dictionary());
/* imports the NumPy C-API */ /* imports the NumPy C-API */
......
...@@ -10,9 +10,9 @@ ...@@ -10,9 +10,9 @@
#include <bob/io/CodecRegistry.h> #include <bob/io/CodecRegistry.h>
#include <bob/io/utils.h> #include <bob/io/utils.h>
#include <numpy/arrayobject.h> #include <numpy/arrayobject.h>
#include <blitz.array/capi.h> #include <xbob.blitz/capi.h>
#include <stdexcept> #include <stdexcept>
#include <bobskin.h> #include "bobskin.h"
#define FILETYPE_NAME File #define FILETYPE_NAME File
PyDoc_STRVAR(s_file_str, BOOST_PP_STRINGIZE(XBOB_IO_MODULE_PREFIX) "." BOOST_PP_STRINGIZE(FILETYPE_NAME)); PyDoc_STRVAR(s_file_str, BOOST_PP_STRINGIZE(XBOB_IO_MODULE_PREFIX) "." BOOST_PP_STRINGIZE(FILETYPE_NAME));
...@@ -443,10 +443,10 @@ Parameters:\n\ ...@@ -443,10 +443,10 @@ Parameters:\n\
\n\ \n\
array\n\ array\n\
[array] The array to be written into the file. It can be a\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\ converted to either of them, as long as the number of\n\
dimensions and scalar type are supported by\n\ dimensions and scalar type are supported by\n\
:py:class:`blitz.array`.\n\ :py:class:`xbob.blitz.array`.\n\
\n\ \n\
This method writes data to the file. It acts like the\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\ given array is the only piece of data that will ever be written\n\
...@@ -496,10 +496,10 @@ Parameters:\n\ ...@@ -496,10 +496,10 @@ Parameters:\n\
\n\ \n\
array\n\ array\n\
[array] The array to be added into the file. It can be a\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\ converted to either of them, as long as the number of\n\
dimensions and scalar type are supported by\n\ dimensions and scalar type are supported by\n\
:py:class:`blitz.array`.\n\ :py:class:`xbob.blitz.array`.\n\
\n\ \n\
This method appends data to the file. If the file does not\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\ exist, creates a new file, else, makes sure that the inserted\n\
......
...@@ -10,9 +10,9 @@ ...@@ -10,9 +10,9 @@
#include <boost/make_shared.hpp> #include <boost/make_shared.hpp>
#include <numpy/arrayobject.h> #include <numpy/arrayobject.h>
#include <blitz.array/cppapi.h> #include <xbob.blitz/cppapi.h>
#include <stdexcept> #include <stdexcept>
#include <bobskin.h> #include "bobskin.h"
#define HDF5FILE_NAME HDF5File #define HDF5FILE_NAME HDF5File
PyDoc_STRVAR(s_hdf5file_str, BOOST_PP_STRINGIZE(XBOB_IO_MODULE_PREFIX) "." BOOST_PP_STRINGIZE(HDF5FILE_NAME)); 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) { ...@@ -890,7 +890,7 @@ static bool PyBobIoHDF5File_IsPythonScalar(PyObject* obj) {
/** /**
* Returns the type of object `op' is - a scalar (return value = 0), a * 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 * 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. * -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* ...@@ -1118,7 +1118,7 @@ static PyObject* PyBobIoHDF5File_Replace(PyBobIoHDF5FileObject* self, PyObject*
else { //write as array else { //write as array
switch (is_array) { switch (is_array) {
case 1: //blitz.array case 1: //xbob.blitz.array
self->f->write_buffer(path, pos, type, ((PyBlitzArrayObject*)data)->data); self->f->write_buffer(path, pos, type, ((PyBlitzArrayObject*)data)->data);
break; break;
...@@ -1252,7 +1252,7 @@ static int PyBobIoHDF5File_InnerAppend(PyBobIoHDF5FileObject* self, const char* ...@@ -1252,7 +1252,7 @@ static int PyBobIoHDF5File_InnerAppend(PyBobIoHDF5FileObject* self, const char*
else { //write as array else { //write as array
switch (is_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); if (!self->f->contains(path)) self->f->create(path, type, true, compression);
self->f->extend_buffer(path, type, ((PyBlitzArrayObject*)data)->data); self->f->extend_buffer(path, type, ((PyBlitzArrayObject*)data)->data);
break; break;
...@@ -1445,7 +1445,7 @@ static PyObject* PyBobIoHDF5File_Set(PyBobIoHDF5FileObject* self, PyObject* args ...@@ -1445,7 +1445,7 @@ static PyObject* PyBobIoHDF5File_Set(PyBobIoHDF5FileObject* self, PyObject* args
else { //write as array else { //write as array
switch (is_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); if (!self->f->contains(path)) self->f->create(path, type, false, compression);
self->f->write_buffer(path, 0, type, ((PyBlitzArrayObject*)data)->data); self->f->write_buffer(path, 0, type, ((PyBlitzArrayObject*)data)->data);
break; break;
...@@ -1873,7 +1873,7 @@ static PyObject* PyBobIoHDF5File_WriteAttribute(PyBobIoHDF5FileObject* self, ...@@ -1873,7 +1873,7 @@ static PyObject* PyBobIoHDF5File_WriteAttribute(PyBobIoHDF5FileObject* self,
try { try {
switch (is_array) { switch (is_array) {
case 1: //blitz.array case 1: //xbob.blitz.array
self->f->write_attribute(path, name, type, ((PyBlitzArrayObject*)o)->data); self->f->write_attribute(path, name, type, ((PyBlitzArrayObject*)o)->data);
break; break;
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#ifdef NO_IMPORT_ARRAY #ifdef NO_IMPORT_ARRAY
#undef NO_IMPORT_ARRAY #undef NO_IMPORT_ARRAY
#endif #endif
#include <blitz.array/capi.h> #include <xbob.blitz/capi.h>
static PyMethodDef module_methods[] = { static PyMethodDef module_methods[] = {
{0} /* Sentinel */ {0} /* Sentinel */
...@@ -51,7 +51,7 @@ PyMODINIT_FUNC ENTRY_FUNCTION(XBOB_IO_MODULE_NAME) (void) { ...@@ -51,7 +51,7 @@ PyMODINIT_FUNC ENTRY_FUNCTION(XBOB_IO_MODULE_NAME) (void) {
/* register some constants */ /* register some constants */
PyModule_AddIntConstant(m, "__api_version__", XBOB_IO_API_VERSION); 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 */ /* register the types to python */
Py_INCREF(&PyBobIoFile_Type); Py_INCREF(&PyBobIoFile_Type);
...@@ -125,7 +125,7 @@ PyMODINIT_FUNC ENTRY_FUNCTION(XBOB_IO_MODULE_NAME) (void) { ...@@ -125,7 +125,7 @@ PyMODINIT_FUNC ENTRY_FUNCTION(XBOB_IO_MODULE_NAME) (void) {
/* imports the NumPy C-API */ /* imports the NumPy C-API */
import_array(); import_array();
/* imports blitz.array C-API */ /* imports xbob.blitz C-API */
import_blitz_array(); import_xbob_blitz();
} }
...@@ -11,9 +11,9 @@ ...@@ -11,9 +11,9 @@
#if WITH_FFMPEG #if WITH_FFMPEG
#include <boost/make_shared.hpp> #include <boost/make_shared.hpp>
#include <numpy/arrayobject.h> #include <numpy/arrayobject.h>
#include <blitz.array/capi.h> #include <xbob.blitz/capi.h>
#include <stdexcept> #include <stdexcept>
#include <bobskin.h> #include "bobskin.h"
#define VIDEOREADER_NAME VideoReader #define VIDEOREADER_NAME VideoReader
PyDoc_STRVAR(s_videoreader_str, BOOST_PP_STRINGIZE(XBOB_IO_MODULE_PREFIX) "." BOOST_PP_STRINGIZE(VIDEOREADER_NAME)); PyDoc_STRVAR(s_videoreader_str, BOOST_PP_STRINGIZE(XBOB_IO_MODULE_PREFIX) "." BOOST_PP_STRINGIZE(VIDEOREADER_NAME));
......
...@@ -11,9 +11,9 @@ ...@@ -11,9 +11,9 @@
#if WITH_FFMPEG #if WITH_FFMPEG
#include <boost/make_shared.hpp> #include <boost/make_shared.hpp>
#include <numpy/arrayobject.h> #include <numpy/arrayobject.h>
#include <blitz.array/cppapi.h> #include <xbob.blitz/cppapi.h>
#include <stdexcept> #include <stdexcept>
#include <bobskin.h> #include "bobskin.h"
#define VIDEOWRITER_NAME VideoWriter #define VIDEOWRITER_NAME VideoWriter
PyDoc_STRVAR(s_videowriter_str, BOOST_PP_STRINGIZE(XBOB_IO_MODULE_PREFIX) "." BOOST_PP_STRINGIZE(VIDEOWRITER_NAME)); PyDoc_STRVAR(s_videowriter_str, BOOST_PP_STRINGIZE(XBOB_IO_MODULE_PREFIX) "." BOOST_PP_STRINGIZE(VIDEOWRITER_NAME));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment