Commit 3cfd9cf0 authored by Manuel Günther's avatar Manuel Günther
Browse files

Based get_config on bob.extension

parent f53bfbbc
......@@ -10,8 +10,10 @@ bob.extension.load_bob_library('bob.learn.em', __file__)
from ._library import *
from . import version
from .version import module as __version__
from .version import api as __api_version__
from .train import *
def ztnorm_same_value(vect_a, vect_b):
"""Computes the matrix of boolean D for the ZT-norm, which indicates where
the client ids of the T-Norm models and Z-Norm samples match.
......@@ -30,21 +32,8 @@ def ztnorm_same_value(vect_a, vect_b):
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('_')]
......@@ -66,13 +66,12 @@ static PyObject* create_module (void) {
if (!module) return 0;
auto module_ = make_safe(module); ///< protects against early returns
if (PyModule_AddStringConstant(module, "__version__", BOB_EXT_MODULE_VERSION) < 0) return 0;
if (!init_BobLearnEMGaussian(module)) return 0;
if (!init_BobLearnEMGMMStats(module)) return 0;
if (!init_BobLearnEMGMMMachine(module)) return 0;
if (!init_BobLearnEMKMeansMachine(module)) return 0;
if (!init_BobLearnEMKMeansTrainer(module)) return 0;
if (!init_BobLearnEMMLGMMTrainer(module)) return 0;
if (!init_BobLearnEMMLGMMTrainer(module)) return 0;
if (!init_BobLearnEMMAPGMMTrainer(module)) return 0;
if (!init_BobLearnEMJFABase(module)) return 0;
......@@ -85,12 +84,12 @@ static PyObject* create_module (void) {
if (!init_BobLearnEMIVectorMachine(module)) return 0;
if (!init_BobLearnEMIVectorTrainer(module)) return 0;
if (!init_BobLearnEMPLDABase(module)) return 0;
if (!init_BobLearnEMPLDAMachine(module)) return 0;
if (!init_BobLearnEMPLDATrainer(module)) return 0;
if (!init_BobLearnEMPLDATrainer(module)) return 0;
if (!init_BobLearnEMEMPCATrainer(module)) return 0;
if (!init_BobLearnEMEMPCATrainer(module)) return 0;
static void* PyBobLearnEM_API[PyBobLearnEM_API_pointers];
......@@ -128,9 +127,7 @@ static PyObject* create_module (void) {
if (import_bob_io_base() < 0) return 0;
if (import_bob_learn_linear() < 0) return 0;
Py_INCREF(module);
return module;
return Py_BuildValue("O", module);
}
PyMODINIT_FUNC BOB_EXT_ENTRY_NAME (void) {
......
......@@ -17,6 +17,7 @@
#include <bob.math/config.h>
#include <bob.learn.activation/config.h>
#include <bob.learn.linear/config.h>
#include <bob.learn.em/config.h>
// TODO: add other dependencies
#include <string>
......@@ -196,8 +197,8 @@ static PyObject* create_module (void) {
auto m_ = make_safe(m); ///< protects against early returns
/* register version numbers and constants */
if (PyModule_AddStringConstant(m, "module", BOB_EXT_MODULE_VERSION) < 0)
return 0;
if (PyModule_AddIntConstant(m, "api", BOB_LEARN_EM_API_VERSION) < 0) return 0;
if (PyModule_AddStringConstant(m, "module", BOB_EXT_MODULE_VERSION) < 0) return 0;
PyObject* externals = build_version_dictionary();
if (!externals) return 0;
......@@ -210,9 +211,7 @@ static PyObject* create_module (void) {
return 0;
}
Py_INCREF(m);
return m;
return Py_BuildValue("O", m);
}
PyMODINIT_FUNC BOB_EXT_ENTRY_NAME (void) {
......
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