__init__.py 1.86 KB
Newer Older
1 2 3
# import Libraries of other lib packages
import bob.io.base

4 5 6 7
# import our own Library
import bob.extension
bob.extension.load_bob_library('bob.io.image', __file__)

André Anjos's avatar
André Anjos committed
8 9 10 11
from . import _library
from . import version
from .version import module as __version__

12 13
import os

André Anjos's avatar
André Anjos committed
14 15 16
def get_config():
  """Returns a string containing the configuration information.
  """
17 18
  import bob.extension
  return bob.extension.get_config(__name__, version.externals)
André Anjos's avatar
André Anjos committed
19

20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52

def get_include_directories():
  """get_include_directories() -> includes

  Returns a list of include directories for dependent libraries, such as libjpeg, libtiff, ...
  This function is automatically used by :py:func:`bob.extension.get_bob_libraries` to retrieve the non-standard include directories that are required to use the C bindings of this library in dependent classes.
  You shouldn't normally need to call this function by hand.

  **Returns:**

  ``includes`` : [str]
    The list of non-standard include directories required to use the C bindings of this class.
    For now, only the directory for the HDF5 headers are returned.
  """
  # try to use pkg_config first
  from bob.extension.utils import find_header, uniq_paths
  from bob.extension import pkgconfig
  import logging
  logger = logging.getLogger("bob.io.image")
  directories = []
  for name, header in (('libjpeg', 'jpeglib.h'), ('libtiff', 'tiff.h'), ('giflib', 'gif_lib.h')):
    # locate pkg-config on our own
    candidates = find_header(header)
    if not candidates:
      logger.warn("could not find %s's `%s' - have you installed %s on this machine?" % (name, header, name))

    directories.append(os.path.dirname(candidates[0]))
  for name in ("libpng",):
    pkg = pkgconfig(name)
    directories.extend(pkg.include_directories())
  return uniq_paths(directories)


André Anjos's avatar
André Anjos committed
53 54
# gets sphinx autodoc done right - don't remove it
__all__ = [_ for _ in dir() if not _.startswith('_')]