From 051a0694ce5f22d4699f7de5563ec470fece425b Mon Sep 17 00:00:00 2001 From: Andre Anjos <andre.dos.anjos@gmail.com> Date: Wed, 14 May 2014 13:32:39 +0200 Subject: [PATCH] Move xbob.io -> xbob.io.base --- buildout.cfg | 2 +- setup.py | 29 +-- xbob/io/__init__.py | 206 +----------------- xbob/io/base/__init__.py | 204 +++++++++++++++++ xbob/io/{ => base}/bobskin.cpp | 0 xbob/io/{ => base}/bobskin.h | 0 xbob/io/{ => base}/codec.cpp | 2 +- xbob/io/{ => base}/data/img_indexed_color.png | Bin xbob/io/{ => base}/data/matlab_1d.hdf5 | Bin xbob/io/{ => base}/data/matlab_2d.hdf5 | Bin xbob/io/{ => base}/data/test.jpg | Bin xbob/io/{ => base}/data/test.mat | Bin xbob/io/{ => base}/data/test.mov | Bin xbob/io/{ => base}/data/test.pbm | 0 xbob/io/{ => base}/data/test.pgm | Bin xbob/io/{ => base}/data/test.ppm | Bin xbob/io/{ => base}/data/test1.hdf5 | Bin xbob/io/{ => base}/data/test7_unlimited.hdf5 | Bin xbob/io/{ => base}/data/test_1d.mat | Bin xbob/io/{ => base}/data/test_1d_cplx.mat | Bin xbob/io/{ => base}/data/test_2d.mat | Bin xbob/io/{ => base}/data/test_2d_cplx.mat | Bin xbob/io/{ => base}/data/test_3d.mat | Bin xbob/io/{ => base}/data/test_3d_cplx.mat | Bin xbob/io/{ => base}/data/test_4d.mat | Bin xbob/io/{ => base}/data/test_4d_cplx.mat | Bin xbob/io/{ => base}/data/test_array_codec.txt | 0 xbob/io/{ => base}/data/test_cell.mat | Bin xbob/io/{ => base}/data/test_h264.mov | Bin xbob/io/{ => base}/data/torch.tensor | Bin xbob/io/{ => base}/data/torch3.bindata | Bin xbob/io/{ => base}/file.cpp | 2 +- xbob/io/{ => base}/fonts/bold.ttf | Bin xbob/io/{ => base}/fonts/bold_italic.ttf | Bin xbob/io/{ => base}/fonts/font_license.txt | 0 xbob/io/{ => base}/fonts/italic.ttf | Bin xbob/io/{ => base}/fonts/regular.ttf | Bin xbob/io/{ => base}/hdf5.cpp | 2 +- .../include/xbob.io.base}/api.h | 28 +-- .../include/xbob.io.base}/config.h | 0 xbob/io/{ => base}/main.cpp | 8 +- xbob/io/{ => base}/script/__init__.py | 0 xbob/io/{ => base}/script/video_test.py | 0 xbob/io/{ => base}/test_file.py | 0 xbob/io/{ => base}/test_hdf5.py | 0 xbob/io/{ => base}/test_image.py | 0 xbob/io/{ => base}/test_utils.py | 0 xbob/io/{ => base}/test_video.py | 0 xbob/io/{ => base}/test_video_codec.py | 0 xbob/io/{ => base}/utils.py | 0 xbob/io/{ => base}/version.cpp | 2 +- xbob/io/{ => base}/videoreader.cpp | 4 +- xbob/io/{ => base}/videowriter.cpp | 2 +- 53 files changed, 247 insertions(+), 244 deletions(-) create mode 100644 xbob/io/base/__init__.py rename xbob/io/{ => base}/bobskin.cpp (100%) rename xbob/io/{ => base}/bobskin.h (100%) rename xbob/io/{ => base}/codec.cpp (98%) rename xbob/io/{ => base}/data/img_indexed_color.png (100%) rename xbob/io/{ => base}/data/matlab_1d.hdf5 (100%) rename xbob/io/{ => base}/data/matlab_2d.hdf5 (100%) rename xbob/io/{ => base}/data/test.jpg (100%) rename xbob/io/{ => base}/data/test.mat (100%) rename xbob/io/{ => base}/data/test.mov (100%) rename xbob/io/{ => base}/data/test.pbm (100%) rename xbob/io/{ => base}/data/test.pgm (100%) rename xbob/io/{ => base}/data/test.ppm (100%) rename xbob/io/{ => base}/data/test1.hdf5 (100%) rename xbob/io/{ => base}/data/test7_unlimited.hdf5 (100%) rename xbob/io/{ => base}/data/test_1d.mat (100%) rename xbob/io/{ => base}/data/test_1d_cplx.mat (100%) rename xbob/io/{ => base}/data/test_2d.mat (100%) rename xbob/io/{ => base}/data/test_2d_cplx.mat (100%) rename xbob/io/{ => base}/data/test_3d.mat (100%) rename xbob/io/{ => base}/data/test_3d_cplx.mat (100%) rename xbob/io/{ => base}/data/test_4d.mat (100%) rename xbob/io/{ => base}/data/test_4d_cplx.mat (100%) rename xbob/io/{ => base}/data/test_array_codec.txt (100%) rename xbob/io/{ => base}/data/test_cell.mat (100%) rename xbob/io/{ => base}/data/test_h264.mov (100%) rename xbob/io/{ => base}/data/torch.tensor (100%) rename xbob/io/{ => base}/data/torch3.bindata (100%) rename xbob/io/{ => base}/file.cpp (99%) rename xbob/io/{ => base}/fonts/bold.ttf (100%) rename xbob/io/{ => base}/fonts/bold_italic.ttf (100%) rename xbob/io/{ => base}/fonts/font_license.txt (100%) rename xbob/io/{ => base}/fonts/italic.ttf (100%) rename xbob/io/{ => base}/fonts/regular.ttf (100%) rename xbob/io/{ => base}/hdf5.cpp (99%) rename xbob/io/{include/xbob.io => base/include/xbob.io.base}/api.h (94%) rename xbob/io/{include/xbob.io => base/include/xbob.io.base}/config.h (100%) rename xbob/io/{ => base}/main.cpp (97%) rename xbob/io/{ => base}/script/__init__.py (100%) rename xbob/io/{ => base}/script/video_test.py (100%) rename xbob/io/{ => base}/test_file.py (100%) rename xbob/io/{ => base}/test_hdf5.py (100%) rename xbob/io/{ => base}/test_image.py (100%) rename xbob/io/{ => base}/test_utils.py (100%) rename xbob/io/{ => base}/test_video.py (100%) rename xbob/io/{ => base}/test_video_codec.py (100%) rename xbob/io/{ => base}/utils.py (100%) rename xbob/io/{ => base}/version.cpp (99%) rename xbob/io/{ => base}/videoreader.cpp (99%) rename xbob/io/{ => base}/videowriter.cpp (99%) diff --git a/buildout.cfg b/buildout.cfg index 9d83950..df31b05 100644 --- a/buildout.cfg +++ b/buildout.cfg @@ -4,7 +4,7 @@ [buildout] parts = scripts -eggs = xbob.io +eggs = xbob.io.base extensions = xbob.buildout mr.developer auto-checkout = * diff --git a/setup.py b/setup.py index 168cb90..0aea744 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ from xbob.blitz.extension import Extension import os package_dir = os.path.dirname(os.path.realpath(__file__)) -package_dir = os.path.join(package_dir, 'xbob', 'io', 'include') +package_dir = os.path.join(package_dir, 'xbob', 'io', 'base', 'include') include_dirs = [package_dir] packages = ['bob-io >= 1.2.2'] @@ -26,10 +26,10 @@ except pkg_resources.DistributionNotFound as e: setup( - name='xbob.io', + name='xbob.io.base', version=version, - description='Bindings for bob.io', - url='http://github.com/bioidiap/xbob.io', + description='Base bindings for bob.io', + url='http://github.com/bioidiap/xbob.io.base', license='BSD', author='Andre Anjos', author_email='andre.anjos@idiap.ch', @@ -46,27 +46,28 @@ setup( namespace_packages=[ "xbob", + "xbob.io", ], ext_modules = [ - Extension("xbob.io.version", + Extension("xbob.io.base.version", [ - "xbob/io/version.cpp", + "xbob/io/base/version.cpp", ], packages = packages, include_dirs = include_dirs, version = version, define_macros = [('__STDC_CONSTANT_MACROS', None)], ), - Extension("xbob.io._library", + Extension("xbob.io.base._library", [ - "xbob/io/bobskin.cpp", - "xbob/io/codec.cpp", - "xbob/io/file.cpp", - "xbob/io/videoreader.cpp", - "xbob/io/videowriter.cpp", - "xbob/io/hdf5.cpp", - "xbob/io/main.cpp", + "xbob/io/base/bobskin.cpp", + "xbob/io/base/codec.cpp", + "xbob/io/base/file.cpp", + "xbob/io/base/videoreader.cpp", + "xbob/io/base/videowriter.cpp", + "xbob/io/base/hdf5.cpp", + "xbob/io/base/main.cpp", ], packages = packages, include_dirs = include_dirs, diff --git a/xbob/io/__init__.py b/xbob/io/__init__.py index 62541ea..60381ea 100644 --- a/xbob/io/__init__.py +++ b/xbob/io/__init__.py @@ -1,204 +1,2 @@ -from ._library import File, VideoReader, VideoWriter, HDF5File -from . import version -from .version import module as __version__ -from .version import api as __api_version__ - -import os - -def create_directories_save(directory, dryrun=False): - """Creates a directory if it does not exists, with concurrent access support. - This function will also create any parent directories that might be required. - If the dryrun option is selected, it does not actually create the directory, - but just writes the (Linux) command that would have been executed. - - Parameters: - - directory - The directory that you want to create. - - dryrun - Only write the command, but do not execute it. - """ - try: - if dryrun: - print("[dry-run] mkdir -p '%s'" % directory) - else: - if directory and not os.path.exists(directory): os.makedirs(directory) - - except OSError as exc: # Python >2.5 - import errno - if exc.errno != errno.EEXIST: - raise - - -def load(inputs): - """Loads the contents of a file, an iterable of files, or an iterable of - :py:class:`bob.io.File`'s into a :py:class:`numpy.ndarray`. - - Parameters: - - inputs - - This might represent several different entities: - - 1. The name of a file (full path) from where to load the data. In this - case, this assumes that the file contains an array and returns a loaded - numpy ndarray. - 2. An iterable of filenames to be loaded in memory. In this case, this - would assume that each file contains a single 1D sample or a set of 1D - samples, load them in memory and concatenate them into a single and - returned 2D numpy ndarray. - 3. An iterable of :py:class:`bob.io.File`. In this case, this would assume - that each :py:class:`bob.io.File` contains a single 1D sample or a set - of 1D samples, load them in memory if required and concatenate them into - a single and returned 2D numpy ndarray. - 4. An iterable with mixed filenames and :py:class:`bob.io.File`. In this - case, this would returned a 2D :py:class:`numpy.ndarray`, as described - by points 2 and 3 above. - """ - - from collections import Iterable - import numpy - from .utils import is_string - if is_string(inputs): - return File(inputs, 'r').read() - elif isinstance(inputs, Iterable): - retval = [] - for obj in inputs: - if is_string(obj): - retval.append(load(obj)) - elif isinstance(obj, File): - retval.append(obj.read()) - else: - raise TypeError("Iterable contains an object which is not a filename nor a bob.io.File.") - return numpy.vstack(retval) - else: - raise TypeError("Unexpected input object. This function is expecting a filename, or an iterable of filenames and/or bob.io.File's") - -def merge(filenames): - """Converts an iterable of filenames into an iterable over read-only - bob.io.File's. - - Parameters: - - filenames - - This might represent: - - 1. A single filename. In this case, an iterable with a single - :py:class:`bob.io.File` is returned. - 2. An iterable of filenames to be converted into an iterable of - :py:class:`bob.io.File`'s. - """ - - from collections import Iterable - from .utils import is_string - if is_string(filenames): - return [File(filenames, 'r')] - elif isinstance(filenames, Iterable): - return [File(k, 'r') for k in filenames] - else: - raise TypeError("Unexpected input object. This function is expecting an iterable of filenames.") - -def save(array, filename, create_directories = False): - """Saves the contents of an array-like object to file. - - Effectively, this is the same as creating a :py:class:`bob.io.File` object - with the mode flag set to `w` (write with truncation) and calling - :py:meth:`bob.io.File.write` passing `array` as parameter. - - Parameters: - - array - The array-like object to be saved on the file - - filename - The name of the file where you need the contents saved to - - create_directories - Automatically generate the directories if required - """ - # create directory if not existent yet - if create_directories: - create_directories_save(os.path.dirname(filename)) - - return File(filename, 'w').write(array) - -# Just to make it homogenous with the C++ API -write = save - -def append(array, filename): - """Appends the contents of an array-like object to file. - - Effectively, this is the same as creating a :py:class:`bob.io.File` object - with the mode flag set to `a` (append) and calling - :py:meth:`bob.io.File.append` passing `array` as parameter. - - Parameters: - - array - The array-like object to be saved on the file - - filename - The name of the file where you need the contents saved to - """ - return File(filename, 'a').append(array) - -def peek(filename): - """Returns the type of array (frame or sample) saved in the given file. - - Effectively, this is the same as creating a :py:class:`bob.io.File` object - with the mode flag set to `r` (read-only) and returning - :py:attr:`bob.io.File.describe()`. - - Parameters: - - filename - The name of the file to peek information from - """ - return File(filename, 'r').describe() - -def peek_all(filename): - """Returns the type of array (for full readouts) saved in the given file. - - Effectively, this is the same as creating a :py:class:`bob.io.File` object - with the mode flag set to `r` (read-only) and returning - :py:attr:`bob.io.File.describe(all=True)`. - - Parameters: - - filename - The name of the file to peek information from - """ - return File(filename, 'r').describe(all=True) - -# Keeps compatibility with the previously existing API -open = File - -def get_include(): - """Returns the directory containing the C/C++ API include directives""" - - return __import__('pkg_resources').resource_filename(__name__, 'include') - -def get_config(): - """Returns a string containing the configuration information. - """ - - import pkg_resources - from .version import externals - - packages = pkg_resources.require(__name__) - this = packages[0] - deps = packages[1:] - - retval = "%s: %s [api=0x%04x] (%s)\n" % (this.key, this.version, - __api_version__, this.location) - retval += " - c/c++ dependencies:\n" - for k in sorted(externals): retval += " - %s: %s\n" % (k, externals[k]) - retval += " - python dependencies:\n" - for d in deps: retval += " - %s: %s (%s)\n" % (d.key, d.version, d.location) - - return retval.strip() - -# gets sphinx autodoc done right - don't remove it -__all__ = [_ for _ in dir() if not _.startswith('_')] +#see http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages +__import__('pkg_resources').declare_namespace(__name__) diff --git a/xbob/io/base/__init__.py b/xbob/io/base/__init__.py new file mode 100644 index 0000000..62541ea --- /dev/null +++ b/xbob/io/base/__init__.py @@ -0,0 +1,204 @@ +from ._library import File, VideoReader, VideoWriter, HDF5File +from . import version +from .version import module as __version__ +from .version import api as __api_version__ + +import os + +def create_directories_save(directory, dryrun=False): + """Creates a directory if it does not exists, with concurrent access support. + This function will also create any parent directories that might be required. + If the dryrun option is selected, it does not actually create the directory, + but just writes the (Linux) command that would have been executed. + + Parameters: + + directory + The directory that you want to create. + + dryrun + Only write the command, but do not execute it. + """ + try: + if dryrun: + print("[dry-run] mkdir -p '%s'" % directory) + else: + if directory and not os.path.exists(directory): os.makedirs(directory) + + except OSError as exc: # Python >2.5 + import errno + if exc.errno != errno.EEXIST: + raise + + +def load(inputs): + """Loads the contents of a file, an iterable of files, or an iterable of + :py:class:`bob.io.File`'s into a :py:class:`numpy.ndarray`. + + Parameters: + + inputs + + This might represent several different entities: + + 1. The name of a file (full path) from where to load the data. In this + case, this assumes that the file contains an array and returns a loaded + numpy ndarray. + 2. An iterable of filenames to be loaded in memory. In this case, this + would assume that each file contains a single 1D sample or a set of 1D + samples, load them in memory and concatenate them into a single and + returned 2D numpy ndarray. + 3. An iterable of :py:class:`bob.io.File`. In this case, this would assume + that each :py:class:`bob.io.File` contains a single 1D sample or a set + of 1D samples, load them in memory if required and concatenate them into + a single and returned 2D numpy ndarray. + 4. An iterable with mixed filenames and :py:class:`bob.io.File`. In this + case, this would returned a 2D :py:class:`numpy.ndarray`, as described + by points 2 and 3 above. + """ + + from collections import Iterable + import numpy + from .utils import is_string + if is_string(inputs): + return File(inputs, 'r').read() + elif isinstance(inputs, Iterable): + retval = [] + for obj in inputs: + if is_string(obj): + retval.append(load(obj)) + elif isinstance(obj, File): + retval.append(obj.read()) + else: + raise TypeError("Iterable contains an object which is not a filename nor a bob.io.File.") + return numpy.vstack(retval) + else: + raise TypeError("Unexpected input object. This function is expecting a filename, or an iterable of filenames and/or bob.io.File's") + +def merge(filenames): + """Converts an iterable of filenames into an iterable over read-only + bob.io.File's. + + Parameters: + + filenames + + This might represent: + + 1. A single filename. In this case, an iterable with a single + :py:class:`bob.io.File` is returned. + 2. An iterable of filenames to be converted into an iterable of + :py:class:`bob.io.File`'s. + """ + + from collections import Iterable + from .utils import is_string + if is_string(filenames): + return [File(filenames, 'r')] + elif isinstance(filenames, Iterable): + return [File(k, 'r') for k in filenames] + else: + raise TypeError("Unexpected input object. This function is expecting an iterable of filenames.") + +def save(array, filename, create_directories = False): + """Saves the contents of an array-like object to file. + + Effectively, this is the same as creating a :py:class:`bob.io.File` object + with the mode flag set to `w` (write with truncation) and calling + :py:meth:`bob.io.File.write` passing `array` as parameter. + + Parameters: + + array + The array-like object to be saved on the file + + filename + The name of the file where you need the contents saved to + + create_directories + Automatically generate the directories if required + """ + # create directory if not existent yet + if create_directories: + create_directories_save(os.path.dirname(filename)) + + return File(filename, 'w').write(array) + +# Just to make it homogenous with the C++ API +write = save + +def append(array, filename): + """Appends the contents of an array-like object to file. + + Effectively, this is the same as creating a :py:class:`bob.io.File` object + with the mode flag set to `a` (append) and calling + :py:meth:`bob.io.File.append` passing `array` as parameter. + + Parameters: + + array + The array-like object to be saved on the file + + filename + The name of the file where you need the contents saved to + """ + return File(filename, 'a').append(array) + +def peek(filename): + """Returns the type of array (frame or sample) saved in the given file. + + Effectively, this is the same as creating a :py:class:`bob.io.File` object + with the mode flag set to `r` (read-only) and returning + :py:attr:`bob.io.File.describe()`. + + Parameters: + + filename + The name of the file to peek information from + """ + return File(filename, 'r').describe() + +def peek_all(filename): + """Returns the type of array (for full readouts) saved in the given file. + + Effectively, this is the same as creating a :py:class:`bob.io.File` object + with the mode flag set to `r` (read-only) and returning + :py:attr:`bob.io.File.describe(all=True)`. + + Parameters: + + filename + The name of the file to peek information from + """ + return File(filename, 'r').describe(all=True) + +# Keeps compatibility with the previously existing API +open = File + +def get_include(): + """Returns the directory containing the C/C++ API include directives""" + + return __import__('pkg_resources').resource_filename(__name__, 'include') + +def get_config(): + """Returns a string containing the configuration information. + """ + + import pkg_resources + from .version import externals + + packages = pkg_resources.require(__name__) + this = packages[0] + deps = packages[1:] + + retval = "%s: %s [api=0x%04x] (%s)\n" % (this.key, this.version, + __api_version__, this.location) + retval += " - c/c++ dependencies:\n" + for k in sorted(externals): retval += " - %s: %s\n" % (k, externals[k]) + retval += " - python dependencies:\n" + for d in deps: retval += " - %s: %s (%s)\n" % (d.key, d.version, d.location) + + return retval.strip() + +# gets sphinx autodoc done right - don't remove it +__all__ = [_ for _ in dir() if not _.startswith('_')] diff --git a/xbob/io/bobskin.cpp b/xbob/io/base/bobskin.cpp similarity index 100% rename from xbob/io/bobskin.cpp rename to xbob/io/base/bobskin.cpp diff --git a/xbob/io/bobskin.h b/xbob/io/base/bobskin.h similarity index 100% rename from xbob/io/bobskin.h rename to xbob/io/base/bobskin.h diff --git a/xbob/io/codec.cpp b/xbob/io/base/codec.cpp similarity index 98% rename from xbob/io/codec.cpp rename to xbob/io/base/codec.cpp index 8c2db07..67a5c27 100644 --- a/xbob/io/codec.cpp +++ b/xbob/io/base/codec.cpp @@ -6,7 +6,7 @@ */ #define XBOB_IO_MODULE -#include <xbob.io/api.h> +#include <xbob.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 = diff --git a/xbob/io/data/img_indexed_color.png b/xbob/io/base/data/img_indexed_color.png similarity index 100% rename from xbob/io/data/img_indexed_color.png rename to xbob/io/base/data/img_indexed_color.png diff --git a/xbob/io/data/matlab_1d.hdf5 b/xbob/io/base/data/matlab_1d.hdf5 similarity index 100% rename from xbob/io/data/matlab_1d.hdf5 rename to xbob/io/base/data/matlab_1d.hdf5 diff --git a/xbob/io/data/matlab_2d.hdf5 b/xbob/io/base/data/matlab_2d.hdf5 similarity index 100% rename from xbob/io/data/matlab_2d.hdf5 rename to xbob/io/base/data/matlab_2d.hdf5 diff --git a/xbob/io/data/test.jpg b/xbob/io/base/data/test.jpg similarity index 100% rename from xbob/io/data/test.jpg rename to xbob/io/base/data/test.jpg diff --git a/xbob/io/data/test.mat b/xbob/io/base/data/test.mat similarity index 100% rename from xbob/io/data/test.mat rename to xbob/io/base/data/test.mat diff --git a/xbob/io/data/test.mov b/xbob/io/base/data/test.mov similarity index 100% rename from xbob/io/data/test.mov rename to xbob/io/base/data/test.mov diff --git a/xbob/io/data/test.pbm b/xbob/io/base/data/test.pbm similarity index 100% rename from xbob/io/data/test.pbm rename to xbob/io/base/data/test.pbm diff --git a/xbob/io/data/test.pgm b/xbob/io/base/data/test.pgm similarity index 100% rename from xbob/io/data/test.pgm rename to xbob/io/base/data/test.pgm diff --git a/xbob/io/data/test.ppm b/xbob/io/base/data/test.ppm similarity index 100% rename from xbob/io/data/test.ppm rename to xbob/io/base/data/test.ppm diff --git a/xbob/io/data/test1.hdf5 b/xbob/io/base/data/test1.hdf5 similarity index 100% rename from xbob/io/data/test1.hdf5 rename to xbob/io/base/data/test1.hdf5 diff --git a/xbob/io/data/test7_unlimited.hdf5 b/xbob/io/base/data/test7_unlimited.hdf5 similarity index 100% rename from xbob/io/data/test7_unlimited.hdf5 rename to xbob/io/base/data/test7_unlimited.hdf5 diff --git a/xbob/io/data/test_1d.mat b/xbob/io/base/data/test_1d.mat similarity index 100% rename from xbob/io/data/test_1d.mat rename to xbob/io/base/data/test_1d.mat diff --git a/xbob/io/data/test_1d_cplx.mat b/xbob/io/base/data/test_1d_cplx.mat similarity index 100% rename from xbob/io/data/test_1d_cplx.mat rename to xbob/io/base/data/test_1d_cplx.mat diff --git a/xbob/io/data/test_2d.mat b/xbob/io/base/data/test_2d.mat similarity index 100% rename from xbob/io/data/test_2d.mat rename to xbob/io/base/data/test_2d.mat diff --git a/xbob/io/data/test_2d_cplx.mat b/xbob/io/base/data/test_2d_cplx.mat similarity index 100% rename from xbob/io/data/test_2d_cplx.mat rename to xbob/io/base/data/test_2d_cplx.mat diff --git a/xbob/io/data/test_3d.mat b/xbob/io/base/data/test_3d.mat similarity index 100% rename from xbob/io/data/test_3d.mat rename to xbob/io/base/data/test_3d.mat diff --git a/xbob/io/data/test_3d_cplx.mat b/xbob/io/base/data/test_3d_cplx.mat similarity index 100% rename from xbob/io/data/test_3d_cplx.mat rename to xbob/io/base/data/test_3d_cplx.mat diff --git a/xbob/io/data/test_4d.mat b/xbob/io/base/data/test_4d.mat similarity index 100% rename from xbob/io/data/test_4d.mat rename to xbob/io/base/data/test_4d.mat diff --git a/xbob/io/data/test_4d_cplx.mat b/xbob/io/base/data/test_4d_cplx.mat similarity index 100% rename from xbob/io/data/test_4d_cplx.mat rename to xbob/io/base/data/test_4d_cplx.mat diff --git a/xbob/io/data/test_array_codec.txt b/xbob/io/base/data/test_array_codec.txt similarity index 100% rename from xbob/io/data/test_array_codec.txt rename to xbob/io/base/data/test_array_codec.txt diff --git a/xbob/io/data/test_cell.mat b/xbob/io/base/data/test_cell.mat similarity index 100% rename from xbob/io/data/test_cell.mat rename to xbob/io/base/data/test_cell.mat diff --git a/xbob/io/data/test_h264.mov b/xbob/io/base/data/test_h264.mov similarity index 100% rename from xbob/io/data/test_h264.mov rename to xbob/io/base/data/test_h264.mov diff --git a/xbob/io/data/torch.tensor b/xbob/io/base/data/torch.tensor similarity index 100% rename from xbob/io/data/torch.tensor rename to xbob/io/base/data/torch.tensor diff --git a/xbob/io/data/torch3.bindata b/xbob/io/base/data/torch3.bindata similarity index 100% rename from xbob/io/data/torch3.bindata rename to xbob/io/base/data/torch3.bindata diff --git a/xbob/io/file.cpp b/xbob/io/base/file.cpp similarity index 99% rename from xbob/io/file.cpp rename to xbob/io/base/file.cpp index 56359e5..c3a3ebd 100644 --- a/xbob/io/file.cpp +++ b/xbob/io/base/file.cpp @@ -7,7 +7,7 @@ #define XBOB_IO_MODULE #include "bobskin.h" -#include <xbob.io/api.h> +#include <xbob.io.base/api.h> #include <bob/io/CodecRegistry.h> #include <bob/io/utils.h> #include <numpy/arrayobject.h> diff --git a/xbob/io/fonts/bold.ttf b/xbob/io/base/fonts/bold.ttf similarity index 100% rename from xbob/io/fonts/bold.ttf rename to xbob/io/base/fonts/bold.ttf diff --git a/xbob/io/fonts/bold_italic.ttf b/xbob/io/base/fonts/bold_italic.ttf similarity index 100% rename from xbob/io/fonts/bold_italic.ttf rename to xbob/io/base/fonts/bold_italic.ttf diff --git a/xbob/io/fonts/font_license.txt b/xbob/io/base/fonts/font_license.txt similarity index 100% rename from xbob/io/fonts/font_license.txt rename to xbob/io/base/fonts/font_license.txt diff --git a/xbob/io/fonts/italic.ttf b/xbob/io/base/fonts/italic.ttf similarity index 100% rename from xbob/io/fonts/italic.ttf rename to xbob/io/base/fonts/italic.ttf diff --git a/xbob/io/fonts/regular.ttf b/xbob/io/base/fonts/regular.ttf similarity index 100% rename from xbob/io/fonts/regular.ttf rename to xbob/io/base/fonts/regular.ttf diff --git a/xbob/io/hdf5.cpp b/xbob/io/base/hdf5.cpp similarity index 99% rename from xbob/io/hdf5.cpp rename to xbob/io/base/hdf5.cpp index c1761d4..8a4cd93 100644 --- a/xbob/io/hdf5.cpp +++ b/xbob/io/base/hdf5.cpp @@ -6,7 +6,7 @@ */ #define XBOB_IO_MODULE -#include <xbob.io/api.h> +#include <xbob.io.base/api.h> #include <boost/make_shared.hpp> #include <numpy/arrayobject.h> diff --git a/xbob/io/include/xbob.io/api.h b/xbob/io/base/include/xbob.io.base/api.h similarity index 94% rename from xbob/io/include/xbob.io/api.h rename to xbob/io/base/include/xbob.io.base/api.h index 8ba2fbf..cab9c10 100644 --- a/xbob/io/include/xbob.io/api.h +++ b/xbob/io/base/include/xbob.io.base/api.h @@ -10,12 +10,12 @@ /* Define Module Name and Prefix for other Modules Note: We cannot use XBOB_EXT_* macros here, unfortunately */ -#define XBOB_IO_PREFIX "xbob.io" -#define XBOB_IO_FULL_NAME "xbob.io._library" +#define XBOB_IO_PREFIX "xbob.io.base" +#define XBOB_IO_FULL_NAME "xbob.io.base._library" #include <Python.h> -#include <xbob.io/config.h> +#include <xbob.io.base/config.h> #include <bob/config.h> #include <bob/io/File.h> #include <bob/io/HDF5File.h> @@ -35,7 +35,7 @@ /* Enum defining entries in the function table */ enum _PyBobIo_ENUM{ PyXbobIo_APIVersion_NUM = 0, - // Bindings for xbob.io.file + // Bindings for xbob.io.base.File PyBobIoFile_Type_NUM, PyBobIoFileIterator_Type_NUM, // I/O generic bindings @@ -66,9 +66,9 @@ enum _PyBobIo_ENUM{ #define PyXbobIo_APIVersion_TYPE int -/***************************** - * Bindings for xbob.io.file * - *****************************/ +/********************************** + * Bindings for xbob.io.base.File * + **********************************/ /* Type definition for PyBobIoFileObject */ typedef struct { @@ -183,7 +183,7 @@ typedef struct { #ifdef XBOB_IO_MODULE - /* This section is used when compiling `xbob.io' itself */ + /* This section is used when compiling `xbob.io.base' itself */ /************** * Versioning * @@ -191,9 +191,9 @@ typedef struct { extern int PyXbobIo_APIVersion; - /***************************** - * Bindings for xbob.io.file * - *****************************/ + /********************************** + * Bindings for xbob.io.base.File * + **********************************/ extern PyBobIoFile_Type_TYPE PyBobIoFile_Type; extern PyBobIoFileIterator_Type_TYPE PyBobIoFileIterator_Type; @@ -244,7 +244,7 @@ typedef struct { #else - /* This section is used in modules that use `xbob.io's' C-API */ + /* This section is used in modules that use `xbob.io.base's' C-API */ # if defined(NO_IMPORT_ARRAY) extern void **PyXbobIo_API; @@ -263,7 +263,7 @@ typedef struct { # define PyXbobIo_APIVersion (*(PyXbobIo_APIVersion_TYPE *)PyXbobIo_API[PyXbobIo_APIVersion_NUM]) /***************************** - * Bindings for xbob.io.file * + * Bindings for xbob.io.File * *****************************/ # define PyBobIoFile_Type (*(PyBobIoFile_Type_TYPE *)PyXbobIo_API[PyBobIoFile_Type_NUM]) @@ -318,7 +318,7 @@ typedef struct { /** * Returns -1 on error, 0 on success. */ - static int import_xbob_io(void) { + static int import_xbob_io_base(void) { PyObject *c_api_object; PyObject *module; diff --git a/xbob/io/include/xbob.io/config.h b/xbob/io/base/include/xbob.io.base/config.h similarity index 100% rename from xbob/io/include/xbob.io/config.h rename to xbob/io/base/include/xbob.io.base/config.h diff --git a/xbob/io/main.cpp b/xbob/io/base/main.cpp similarity index 97% rename from xbob/io/main.cpp rename to xbob/io/base/main.cpp index 2374c28..b890c7f 100644 --- a/xbob/io/main.cpp +++ b/xbob/io/base/main.cpp @@ -6,7 +6,7 @@ */ #define XBOB_IO_MODULE -#include <xbob.io/api.h> +#include <xbob.io.base/api.h> #ifdef NO_IMPORT_ARRAY #undef NO_IMPORT_ARRAY @@ -98,9 +98,9 @@ static PyObject* create_module (void) { PyXbobIo_API[PyXbobIo_APIVersion_NUM] = (void *)&PyXbobIo_APIVersion; - /***************************** - * Bindings for xbob.io.file * - *****************************/ + /********************************** + * Bindings for xbob.io.base.File * + **********************************/ PyXbobIo_API[PyBobIoFile_Type_NUM] = (void *)&PyBobIoFile_Type; diff --git a/xbob/io/script/__init__.py b/xbob/io/base/script/__init__.py similarity index 100% rename from xbob/io/script/__init__.py rename to xbob/io/base/script/__init__.py diff --git a/xbob/io/script/video_test.py b/xbob/io/base/script/video_test.py similarity index 100% rename from xbob/io/script/video_test.py rename to xbob/io/base/script/video_test.py diff --git a/xbob/io/test_file.py b/xbob/io/base/test_file.py similarity index 100% rename from xbob/io/test_file.py rename to xbob/io/base/test_file.py diff --git a/xbob/io/test_hdf5.py b/xbob/io/base/test_hdf5.py similarity index 100% rename from xbob/io/test_hdf5.py rename to xbob/io/base/test_hdf5.py diff --git a/xbob/io/test_image.py b/xbob/io/base/test_image.py similarity index 100% rename from xbob/io/test_image.py rename to xbob/io/base/test_image.py diff --git a/xbob/io/test_utils.py b/xbob/io/base/test_utils.py similarity index 100% rename from xbob/io/test_utils.py rename to xbob/io/base/test_utils.py diff --git a/xbob/io/test_video.py b/xbob/io/base/test_video.py similarity index 100% rename from xbob/io/test_video.py rename to xbob/io/base/test_video.py diff --git a/xbob/io/test_video_codec.py b/xbob/io/base/test_video_codec.py similarity index 100% rename from xbob/io/test_video_codec.py rename to xbob/io/base/test_video_codec.py diff --git a/xbob/io/utils.py b/xbob/io/base/utils.py similarity index 100% rename from xbob/io/utils.py rename to xbob/io/base/utils.py diff --git a/xbob/io/version.cpp b/xbob/io/base/version.cpp similarity index 99% rename from xbob/io/version.cpp rename to xbob/io/base/version.cpp index 9fcd952..0b7eae2 100644 --- a/xbob/io/version.cpp +++ b/xbob/io/base/version.cpp @@ -11,7 +11,7 @@ #undef NO_IMPORT_ARRAY #endif #define XBOB_IO_MODULE -#include <xbob.io/config.h> +#include <xbob.io.base/config.h> #include <string> #include <cstdlib> diff --git a/xbob/io/videoreader.cpp b/xbob/io/base/videoreader.cpp similarity index 99% rename from xbob/io/videoreader.cpp rename to xbob/io/base/videoreader.cpp index 6dae23f..7aa0c08 100644 --- a/xbob/io/videoreader.cpp +++ b/xbob/io/base/videoreader.cpp @@ -7,7 +7,7 @@ #define XBOB_IO_MODULE #include "bobskin.h" -#include <xbob.io/api.h> +#include <xbob.io.base/api.h> #if WITH_FFMPEG #include <boost/make_shared.hpp> @@ -41,7 +41,7 @@ implementation uses `FFmpeg <http://ffmpeg.org>`_ (or\n\ `libav <http://libav.org>`_ if FFmpeg is not available) which is\n\ a stable freely available video encoding and decoding library,\n\ designed specifically for these tasks. You can read an entire\n\ -video in memory by using the :py:meth:`xbob.io.VideoReader.load`\n\ +video in memory by using the :py:meth:`xbob.io.video.Reader.load`\n\ method or use iterators to read it frame by frame and avoid\n\ overloading your machine\'s memory. The maximum precision data\n\ `FFmpeg`_ will yield is a 24-bit (8-bit per band) representation\n\ diff --git a/xbob/io/videowriter.cpp b/xbob/io/base/videowriter.cpp similarity index 99% rename from xbob/io/videowriter.cpp rename to xbob/io/base/videowriter.cpp index c1603c6..1f26aab 100644 --- a/xbob/io/videowriter.cpp +++ b/xbob/io/base/videowriter.cpp @@ -7,7 +7,7 @@ #define XBOB_IO_MODULE #include "bobskin.h" -#include <xbob.io/api.h> +#include <xbob.io.base/api.h> #if WITH_FFMPEG #include <boost/make_shared.hpp> -- GitLab