From 423da5cef30e5e85177e3f06691051459759844d Mon Sep 17 00:00:00 2001
From: Manuel Guenther <manuel.guenther@idiap.ch>
Date: Mon, 5 Jan 2015 14:57:30 +0100
Subject: [PATCH] Added function to retrieve HDF5 header directories

---
 bob/io/base/__init__.py | 20 ++++++++++++++++++++
 setup.py                |  2 +-
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/bob/io/base/__init__.py b/bob/io/base/__init__.py
index 47ce5c2..1ad32e9 100644
--- a/bob/io/base/__init__.py
+++ b/bob/io/base/__init__.py
@@ -214,5 +214,25 @@ def get_config():
 
   return retval.strip()
 
+
+def get_include_directories():
+  """Returns a list of include directories for dependent libraries, such as HDF5."""
+  from bob.extension import pkgconfig
+  # try to use pkg_config first
+  try: 
+    pkg = pkgconfig('hdf5')
+    return pkg.include_directories()
+  except RuntimeError:
+    from bob.extension.utils import find_header
+    # locate pkg-config on our own
+    header = 'hdf5.h'
+    candidates = find_header(header)
+    if not candidates:
+      raise RuntimeError("could not find %s's `%s' - have you installed %s on this machine?" % ('hdf5', header, 'hdf5'))
+
+    return [os.path.dirname(candidates[0])]
+
+  
+
 # gets sphinx autodoc done right - don't remove it
 __all__ = [_ for _ in dir() if not _.startswith('_')]
diff --git a/setup.py b/setup.py
index b085a65..d7708a4 100644
--- a/setup.py
+++ b/setup.py
@@ -8,7 +8,7 @@ bob_packages = ['bob.core']
 from setuptools import setup, find_packages, dist
 dist.Distribution(dict(setup_requires=['bob.extension', 'bob.blitz'] + bob_packages))
 from bob.extension.utils import egrep, find_header, find_library
-from bob.extension.pkgconfig import pkgconfig
+from bob.extension import pkgconfig
 from bob.blitz.extension import Extension, Library, build_ext
 
 from bob.extension.utils import load_requirements
-- 
GitLab