From 81eb5af23709fd30c6bc24b6ce0ba6d65c22d9fd Mon Sep 17 00:00:00 2001 From: Manuel Guenther Date: Wed, 20 May 2015 10:31:00 +0200 Subject: [PATCH] Based get_config on bob.extension --- bob/ip/base/__init__.py | 15 +-------------- bob/ip/base/version.cpp | 2 ++ 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/bob/ip/base/__init__.py b/bob/ip/base/__init__.py index 36e52b7..49c228b 100644 --- a/bob/ip/base/__init__.py +++ b/bob/ip/base/__init__.py @@ -16,21 +16,8 @@ def get_config(): """Returns a string containing the configuration information. """ + return bob.extension.get_config(__name__, version.externals, version.api) - import pkg_resources - from .version import externals - - packages = pkg_resources.require(__name__) - this = packages[0] - deps = packages[1:] - - retval = "%s: %s (%s)\n" % (this.key, this.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/bob/ip/base/version.cpp b/bob/ip/base/version.cpp index 9be74ff..fe43051 100644 --- a/bob/ip/base/version.cpp +++ b/bob/ip/base/version.cpp @@ -25,6 +25,7 @@ #include #include #include +#include static int dict_set(PyObject* d, const char* key, const char* value) { PyObject* v = Py_BuildValue("s", value); @@ -190,6 +191,7 @@ static PyObject* create_module (void) { auto m_ = make_safe(m); ///< protects against early returns /* register version numbers and constants */ + if (PyModule_AddIntConstant(m, "api", BOB_IP_BASE_API_VERSION) < 0) return 0; if (PyModule_AddStringConstant(m, "module", BOB_EXT_MODULE_VERSION) < 0) return 0; PyObject* externals = build_version_dictionary();