Commit 2f3709a7 authored by Manuel Günther's avatar Manuel Günther

added get_include_directories() function in package

parent 6696aa7d
......@@ -9,11 +9,46 @@ from . import _library
from . import version
from .version import module as __version__
import os
def get_config():
"""Returns a string containing the configuration information.
"""
import bob.extension
return bob.extension.get_config(__name__, version.externals)
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)
# gets sphinx autodoc done right - don't remove it
__all__ = [_ for _ in dir() if not _.startswith('_')]
......@@ -111,7 +111,7 @@ class jpeg:
candidates = find_library(module, version=self.version, prefixes=[prefix], only_static=only_static)
if not candidates:
raise RuntimeError("cannot find required %s binary module `%s' - make sure libsvm is installed on `%s'" % (self.name, module, prefix))
raise RuntimeError("cannot find required %s binary module `%s' - make sure `%s' is installed on `%s'" % (self.name, module, self.name, prefix))
# libraries
self.libraries = []
......@@ -207,7 +207,7 @@ class tiff:
candidates = find_library(module, version=self.version, prefixes=[prefix], only_static=only_static)
if not candidates:
raise RuntimeError("cannot find required %s binary module `%s' - make sure libsvm is installed on `%s'" % (self.name, module, prefix))
raise RuntimeError("cannot find required %s binary module `%s' - make sure `%s' is installed on `%s'" % (self.name, module, self.name, prefix))
# libraries
self.libraries = []
......@@ -309,7 +309,7 @@ class gif:
candidates = find_library(module, version=self.version, prefixes=[prefix], only_static=only_static)
if not candidates:
raise RuntimeError("cannot find required %s binary module `%s' - make sure libsvm is installed on `%s'" % (self.name, module, prefix))
raise RuntimeError("cannot find required %s binary module `%s' - make sure `%s' is installed on `%s'" % (self.name, module, self.name, prefix))
# libraries
self.libraries = []
......
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