Commit 3da2ab67 authored by André Anjos's avatar André Anjos 💬
Browse files

xbob -> bob

parent 9ee45de5
......@@ -25,8 +25,8 @@ install:
- "python bootstrap.py"
- "CFLAGS=-coverage ./bin/buildout"
script:
- "./bin/python -c 'from xbob.io.base import get_config; print(get_config())'"
- "./bin/coverage run --source=xbob.io.base ./bin/nosetests -sv"
- "./bin/python -c 'from bob.io.base import get_config; print(get_config())'"
- "./bin/coverage run --source=bob.io.base ./bin/nosetests -sv"
- "./bin/sphinx-build -b doctest doc sphinx"
- "./bin/sphinx-build -b html doc sphinx"
after_success:
......
include LICENSE README.rst bootstrap.py buildout.cfg
recursive-include doc conf.py *.rst
recursive-include xbob *.cpp *.h
recursive-include xbob/io/base/data *.*
recursive-include bob *.cpp *.h
recursive-include bob/io/base/data *.*
......@@ -2,16 +2,16 @@
.. Andre Anjos <andre.anjos@idiap.ch>
.. Thu 29 Aug 2013 16:07:57 CEST
.. image:: https://travis-ci.org/bioidiap/xbob.io.base.svg?branch=master
:target: https://travis-ci.org/bioidiap/xbob.io.base
.. image:: https://coveralls.io/repos/bioidiap/xbob.io.base/badge.png
:target: https://coveralls.io/r/bioidiap/xbob.io.base
.. image:: http://img.shields.io/github/tag/bioidiap/xbob.io.base.png
:target: https://github.com/bioidiap/xbob.io.base
.. image:: http://img.shields.io/pypi/v/xbob.io.base.png
:target: https://pypi.python.org/pypi/xbob.io.base
.. image:: http://img.shields.io/pypi/dm/xbob.io.base.png
:target: https://pypi.python.org/pypi/xbob.io.base
.. image:: https://travis-ci.org/bioidiap/bob.io.base.svg?branch=master
:target: https://travis-ci.org/bioidiap/bob.io.base
.. image:: https://coveralls.io/repos/bioidiap/bob.io.base/badge.png
:target: https://coveralls.io/r/bioidiap/bob.io.base
.. image:: http://img.shields.io/github/tag/bioidiap/bob.io.base.png
:target: https://github.com/bioidiap/bob.io.base
.. image:: http://img.shields.io/pypi/v/bob.io.base.png
:target: https://pypi.python.org/pypi/bob.io.base
.. image:: http://img.shields.io/pypi/dm/bob.io.base.png
:target: https://pypi.python.org/pypi/bob.io.base
=============================
Python bindings for bob::io
......@@ -41,7 +41,7 @@ Testing
You can run a set of tests using the nose test runner::
$ nosetests -sv xbob.io.base
$ nosetests -sv bob.io.base
.. warning::
......@@ -58,7 +58,7 @@ You can run our documentation tests using sphinx itself::
You can test overall test coverage with::
$ nosetests --with-coverage --cover-package=xbob.io.base
$ nosetests --with-coverage --cover-package=bob.io.base
The ``coverage`` egg must be installed for this to work properly.
......
......@@ -14,7 +14,7 @@
#include <bob/core/array.h>
extern "C" {
#include <xbob.blitz/capi.h>
#include <bob.blitz/capi.h>
}
......
......@@ -5,8 +5,8 @@
* @brief Bindings to bob::io::CodecRegistry
*/
#define XBOB_IO_BASE_MODULE
#include <xbob.io.base/api.h>
#define BOB_IO_BASE_MODULE
#include <bob.io.base/api.h>
int PyBobIoCodec_Register (const char* extension, const char* description, bob::io::file_factory_t factory) {
boost::shared_ptr<bob::io::CodecRegistry> instance =
......
......@@ -5,18 +5,18 @@
* @brief Bindings to bob::io::File
*/
#define XBOB_IO_BASE_MODULE
#define BOB_IO_BASE_MODULE
#include "bobskin.h"
#include <xbob.io.base/api.h>
#include <bob.io.base/api.h>
#include <bob/io/CodecRegistry.h>
#include <bob/io/utils.h>
#include <numpy/arrayobject.h>
#include <xbob.blitz/capi.h>
#include <xbob.blitz/cleanup.h>
#include <bob.blitz/capi.h>
#include <bob.blitz/cleanup.h>
#include <stdexcept>
#define FILETYPE_NAME "File"
PyDoc_STRVAR(s_file_str, XBOB_EXT_MODULE_PREFIX "." FILETYPE_NAME);
PyDoc_STRVAR(s_file_str, BOB_EXT_MODULE_PREFIX "." FILETYPE_NAME);
PyDoc_STRVAR(s_file_doc,
"File(filename, [mode='r', [pretend_extension='']]) -> new bob::io::File\n\
......@@ -477,10 +477,10 @@ Parameters:\n\
\n\
array\n\
[array] The array to be written into the file. It can be a\n\
numpy, a xbob.blitz.array or any other object which can be\n\
numpy, a bob.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:`xbob.blitz.array`.\n\
:py:class:`bob.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\
......@@ -530,10 +530,10 @@ Parameters:\n\
\n\
array\n\
[array] The array to be added into the file. It can be a\n\
numpy, a xbob.blitz.array or any other object which can be\n\
numpy, a bob.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:`xbob.blitz.array`.\n\
:py:class:`bob.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\
......@@ -630,7 +630,7 @@ static PyMethodDef PyBobIoFile_Methods[] = {
**********************************/
#define FILEITERTYPE_NAME "File.iter"
PyDoc_STRVAR(s_fileiterator_str, XBOB_EXT_MODULE_PREFIX "." FILEITERTYPE_NAME);
PyDoc_STRVAR(s_fileiterator_str, BOB_EXT_MODULE_PREFIX "." FILEITERTYPE_NAME);
/* How to create a new PyBobIoFileIteratorObject */
static PyObject* PyBobIoFileIterator_New(PyTypeObject* type, PyObject*, PyObject*) {
......
......@@ -5,18 +5,18 @@
* @brief Bindings to bob::io::HDF5File
*/
#define XBOB_IO_BASE_MODULE
#include <xbob.io.base/api.h>
#define BOB_IO_BASE_MODULE
#include <bob.io.base/api.h>
#include <boost/make_shared.hpp>
#include <numpy/arrayobject.h>
#include <xbob.blitz/cppapi.h>
#include <xbob.blitz/cleanup.h>
#include <bob.blitz/cppapi.h>
#include <bob.blitz/cleanup.h>
#include <stdexcept>
#include <cstring>
#define HDF5FILE_NAME "HDF5File"
PyDoc_STRVAR(s_hdf5file_str, XBOB_EXT_MODULE_PREFIX "." HDF5FILE_NAME);
PyDoc_STRVAR(s_hdf5file_str, BOB_EXT_MODULE_PREFIX "." HDF5FILE_NAME);
PyDoc_STRVAR(s_hdf5file_doc,
"HDF5File(filename, [mode='r']) -> new bob::io::HDF5File\n\
......@@ -978,7 +978,7 @@ static bool PyBobIoHDF5File_IsPythonScalar(PyObject* obj) {
/**
* Returns the type of object `op' is - a scalar (return value = 0), a
* xbob.blitzarray (return value = 1), a numpy.ndarray (return value = 2), an
* bob.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.
*
......@@ -1208,7 +1208,7 @@ static PyObject* PyBobIoHDF5File_Replace(PyBobIoHDF5FileObject* self, PyObject*
else { //write as array
switch (is_array) {
case 1: //xbob.blitz.array
case 1: //bob.blitz.array
self->f->write_buffer(path, pos, type, ((PyBlitzArrayObject*)data)->data);
break;
......@@ -1341,7 +1341,7 @@ static int PyBobIoHDF5File_InnerAppend(PyBobIoHDF5FileObject* self, const char*
else { //write as array
switch (is_array) {
case 1: //xbob.blitz.array
case 1: //bob.blitz.array
if (!self->f->contains(path)) self->f->create(path, type, true, compression);
self->f->extend_buffer(path, type, ((PyBlitzArrayObject*)data)->data);
break;
......@@ -1532,7 +1532,7 @@ static PyObject* PyBobIoHDF5File_Set(PyBobIoHDF5FileObject* self, PyObject* args
else { //write as array
switch (is_array) {
case 1: //xbob.blitz.array
case 1: //bob.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;
......@@ -1962,7 +1962,7 @@ static PyObject* PyBobIoHDF5File_WriteAttribute(PyBobIoHDF5FileObject* self,
try {
switch (is_array) {
case 1: //xbob.blitz.array
case 1: //bob.blitz.array
self->f->write_attribute(path, name, type, ((PyBlitzArrayObject*)o)->data);
break;
......
......@@ -5,17 +5,17 @@
* @brief C/C++ API for bob::io
*/
#ifndef XBOB_IO_BASE_H
#define XBOB_IO_BASE_H
#ifndef BOB_IO_BASE_H
#define BOB_IO_BASE_H
/* Define Module Name and Prefix for other Modules
Note: We cannot use XBOB_EXT_* macros here, unfortunately */
#define XBOB_IO_BASE_PREFIX "xbob.io.base"
#define XBOB_IO_BASE_FULL_NAME "xbob.io.base._library"
Note: We cannot use BOB_EXT_* macros here, unfortunately */
#define BOB_IO_BASE_PREFIX "bob.io.base"
#define BOB_IO_BASE_FULL_NAME "bob.io.base._library"
#include <Python.h>
#include <xbob.io.base/config.h>
#include <bob.io.base/config.h>
#include <bob/config.h>
#include <bob/io/File.h>
#include <bob/io/HDF5File.h>
......@@ -29,8 +29,8 @@
/* Enum defining entries in the function table */
enum _PyBobIo_ENUM{
PyXbobIo_APIVersion_NUM = 0,
// Bindings for xbob.io.base.File
PyBobIo_APIVersion_NUM = 0,
// Bindings for bob.io.base.File
PyBobIoFile_Type_NUM,
PyBobIoFileIterator_Type_NUM,
// I/O generic bindings
......@@ -47,17 +47,17 @@ enum _PyBobIo_ENUM{
PyBobIoCodec_IsRegistered_NUM,
PyBobIoCodec_GetDescription_NUM,
// Total number of C API pointers
PyXbobIo_API_pointers
PyBobIo_API_pointers
};
/**************
* Versioning *
**************/
#define PyXbobIo_APIVersion_TYPE int
#define PyBobIo_APIVersion_TYPE int
/**********************************
* Bindings for xbob.io.base.File *
* Bindings for bob.io.base.File *
**********************************/
/* Type definition for PyBobIoFileObject */
......@@ -131,18 +131,18 @@ typedef struct {
#define PyBobIoCodec_GetDescription_RET const char*
#define PyBobIoCodec_GetDescription_PROTO (const char* extension)
#ifdef XBOB_IO_BASE_MODULE
#ifdef BOB_IO_BASE_MODULE
/* This section is used when compiling `xbob.io.base' itself */
/* This section is used when compiling `bob.io.base' itself */
/**************
* Versioning *
**************/
extern int PyXbobIo_APIVersion;
extern int PyBobIo_APIVersion;
/**********************************
* Bindings for xbob.io.base.File *
* Bindings for bob.io.base.File *
**********************************/
extern PyBobIoFile_Type_TYPE PyBobIoFile_Type;
......@@ -182,15 +182,15 @@ typedef struct {
#else
/* This section is used in modules that use `xbob.io.base's' C-API */
/* This section is used in modules that use `bob.io.base's' C-API */
# if defined(NO_IMPORT_ARRAY)
extern void **PyXbobIo_API;
extern void **PyBobIo_API;
# else
# if defined(PY_ARRAY_UNIQUE_SYMBOL)
void **PyXbobIo_API;
void **PyBobIo_API;
# else
static void **PyXbobIo_API=NULL;
static void **PyBobIo_API=NULL;
# endif
# endif
......@@ -198,58 +198,58 @@ typedef struct {
* Versioning *
**************/
# define PyXbobIo_APIVersion (*(PyXbobIo_APIVersion_TYPE *)PyXbobIo_API[PyXbobIo_APIVersion_NUM])
# define PyBobIo_APIVersion (*(PyBobIo_APIVersion_TYPE *)PyBobIo_API[PyBobIo_APIVersion_NUM])
/*****************************
* Bindings for xbob.io.File *
* Bindings for bob.io.File *
*****************************/
# define PyBobIoFile_Type (*(PyBobIoFile_Type_TYPE *)PyXbobIo_API[PyBobIoFile_Type_NUM])
# define PyBobIoFileIterator_Type (*(PyBobIoFileIterator_Type_TYPE *)PyXbobIo_API[PyBobIoFileIterator_Type_NUM])
# define PyBobIoFile_Type (*(PyBobIoFile_Type_TYPE *)PyBobIo_API[PyBobIoFile_Type_NUM])
# define PyBobIoFileIterator_Type (*(PyBobIoFileIterator_Type_TYPE *)PyBobIo_API[PyBobIoFileIterator_Type_NUM])
/************************
* I/O generic bindings *
************************/
# define PyBobIo_AsTypenum (*(PyBobIo_AsTypenum_RET (*)PyBobIo_AsTypenum_PROTO) PyXbobIo_API[PyBobIo_AsTypenum_NUM])
# define PyBobIo_AsTypenum (*(PyBobIo_AsTypenum_RET (*)PyBobIo_AsTypenum_PROTO) PyBobIo_API[PyBobIo_AsTypenum_NUM])
# define PyBobIo_TypeInfoAsTuple (*(PyBobIo_TypeInfoAsTuple_RET (*)PyBobIo_TypeInfoAsTuple_PROTO) PyXbobIo_API[PyBobIo_TypeInfoAsTuple_NUM])
# define PyBobIo_TypeInfoAsTuple (*(PyBobIo_TypeInfoAsTuple_RET (*)PyBobIo_TypeInfoAsTuple_PROTO) PyBobIo_API[PyBobIo_TypeInfoAsTuple_NUM])
# define PyBobIo_FilenameConverter (*(PyBobIo_FilenameConverter_RET (*)PyBobIo_FilenameConverter_PROTO) PyXbobIo_API[PyBobIo_FilenameConverter_NUM])
# define PyBobIo_FilenameConverter (*(PyBobIo_FilenameConverter_RET (*)PyBobIo_FilenameConverter_PROTO) PyBobIo_API[PyBobIo_FilenameConverter_NUM])
/*****************
* HDF5 bindings *
*****************/
# define PyBobIoHDF5File_Type (*(PyBobIoHDF5File_Type_TYPE *)PyXbobIo_API[PyBobIoHDF5File_Type_NUM])
# define PyBobIoHDF5File_Type (*(PyBobIoHDF5File_Type_TYPE *)PyBobIo_API[PyBobIoHDF5File_Type_NUM])
# define PyBobIoHDF5File_Check (*(PyBobIoHDF5File_Check_RET (*)PyBobIoHDF5File_Check_PROTO) PyXbobIo_API[PyBobIoHDF5File_Check_NUM])
# define PyBobIoHDF5File_Check (*(PyBobIoHDF5File_Check_RET (*)PyBobIoHDF5File_Check_PROTO) PyBobIo_API[PyBobIoHDF5File_Check_NUM])
# define PyBobIoHDF5File_Converter (*(PyBobIoHDF5File_Converter_RET (*)PyBobIoHDF5File_Converter_PROTO) PyXbobIo_API[PyBobIoHDF5File_Converter_NUM])
# define PyBobIoHDF5File_Converter (*(PyBobIoHDF5File_Converter_RET (*)PyBobIoHDF5File_Converter_PROTO) PyBobIo_API[PyBobIoHDF5File_Converter_NUM])
/*****************************************
* Code Registration and De-registration *
*****************************************/
# define PyBobIoCodec_Register (*(PyBobIoCodec_Register_RET (*)PyBobIoCodec_Register_PROTO) PyXbobIo_API[PyBobIoCodec_Register_NUM])
# define PyBobIoCodec_Register (*(PyBobIoCodec_Register_RET (*)PyBobIoCodec_Register_PROTO) PyBobIo_API[PyBobIoCodec_Register_NUM])
# define PyBobIoCodec_Deregister (*(PyBobIoCodec_Deregister_RET (*)PyBobIoCodec_Deregister_PROTO) PyXbobIo_API[PyBobIoCodec_Deregister_NUM])
# define PyBobIoCodec_Deregister (*(PyBobIoCodec_Deregister_RET (*)PyBobIoCodec_Deregister_PROTO) PyBobIo_API[PyBobIoCodec_Deregister_NUM])
# define PyBobIoCodec_IsRegistered (*(PyBobIoCodec_IsRegistered_RET (*)PyBobIoCodec_IsRegistered_PROTO) PyXbobIo_API[PyBobIoCodec_IsRegistered_NUM])
# define PyBobIoCodec_IsRegistered (*(PyBobIoCodec_IsRegistered_RET (*)PyBobIoCodec_IsRegistered_PROTO) PyBobIo_API[PyBobIoCodec_IsRegistered_NUM])
# define PyBobIoCodec_GetDescription (*(PyBobIoCodec_GetDescription_RET (*)PyBobIoCodec_GetDescription_PROTO) PyXbobIo_API[PyBobIoCodec_GetDescription_NUM])
# define PyBobIoCodec_GetDescription (*(PyBobIoCodec_GetDescription_RET (*)PyBobIoCodec_GetDescription_PROTO) PyBobIo_API[PyBobIoCodec_GetDescription_NUM])
# if !defined(NO_IMPORT_ARRAY)
/**
* Returns -1 on error, 0 on success.
*/
static int import_xbob_io_base(void) {
static int import_bob_io_base(void) {
PyObject *c_api_object;
PyObject *module;
module = PyImport_ImportModule(XBOB_IO_BASE_FULL_NAME);
module = PyImport_ImportModule(BOB_IO_BASE_FULL_NAME);
if (module == NULL) return -1;
......@@ -262,34 +262,34 @@ typedef struct {
# if PY_VERSION_HEX >= 0x02070000
if (PyCapsule_CheckExact(c_api_object)) {
PyXbobIo_API = (void **)PyCapsule_GetPointer(c_api_object,
PyBobIo_API = (void **)PyCapsule_GetPointer(c_api_object,
PyCapsule_GetName(c_api_object));
}
# else
if (PyCObject_Check(c_api_object)) {
PyXbobIo_API = (void **)PyCObject_AsVoidPtr(c_api_object);
PyBobIo_API = (void **)PyCObject_AsVoidPtr(c_api_object);
}
# endif
Py_DECREF(c_api_object);
Py_DECREF(module);
if (!PyXbobIo_API) {
if (!PyBobIo_API) {
PyErr_SetString(PyExc_ImportError, "cannot find C/C++ API "
# if PY_VERSION_HEX >= 0x02070000
"capsule"
# else
"cobject"
# endif
" at `" XBOB_IO_BASE_FULL_NAME "._C_API'");
" at `" BOB_IO_BASE_FULL_NAME "._C_API'");
return -1;
}
/* Checks that the imported version matches the compiled version */
int imported_version = *(int*)PyXbobIo_API[PyXbobIo_APIVersion_NUM];
int imported_version = *(int*)PyBobIo_API[PyBobIo_APIVersion_NUM];
if (XBOB_IO_BASE_API_VERSION != imported_version) {
PyErr_Format(PyExc_ImportError, XBOB_IO_BASE_FULL_NAME " import error: you compiled against API version 0x%04x, but are now importing an API with version 0x%04x which is not compatible - check your Python runtime environment for errors", XBOB_IO_BASE_API_VERSION, imported_version);
if (BOB_IO_BASE_API_VERSION != imported_version) {
PyErr_Format(PyExc_ImportError, BOB_IO_BASE_FULL_NAME " import error: you compiled against API version 0x%04x, but are now importing an API with version 0x%04x which is not compatible - check your Python runtime environment for errors", BOB_IO_BASE_API_VERSION, imported_version);
return -1;
}
......@@ -300,6 +300,6 @@ typedef struct {
# endif //!defined(NO_IMPORT_ARRAY)
#endif /* XBOB_IO_BASE_MODULE */
#endif /* BOB_IO_BASE_MODULE */
#endif /* XBOB_IO_BASE_H */
#endif /* BOB_IO_BASE_H */
......@@ -2,13 +2,13 @@
* @author Andre Anjos <andre.anjos@idiap.ch>
* @date Fri 1 Nov 07:10:59 2013
*
* @brief General directives for all modules in xbob.io
* @brief General directives for all modules in bob.io
*/
#ifndef XBOB_IO_BASE_CONFIG_H
#define XBOB_IO_BASE_CONFIG_H
#ifndef BOB_IO_BASE_CONFIG_H
#define BOB_IO_BASE_CONFIG_H
/* Macros that define versions and important names */
#define XBOB_IO_BASE_API_VERSION 0x0200
#define BOB_IO_BASE_API_VERSION 0x0200
#endif /* XBOB_IO_BASE_CONFIG_H */
#endif /* BOB_IO_BASE_CONFIG_H */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment