Commit 5b39757f authored by Manuel Günther's avatar Manuel Günther

Moved 'version' to version.so; based get_config on bob.extension

parent 53f9d45f
......@@ -5,30 +5,17 @@ import bob.core
import bob.extension
bob.extension.load_bob_library('bob.math', __file__)
from ._library import __version__
from ._library import *
from . import version
from .version import module as __version__
from .version import api as __api_version__
# To get the full API documentation automatically
__all__ = dir()
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('_')]
......@@ -507,10 +507,6 @@ static PyObject* create_module (void) {
if (!m) return 0;
auto m_ = make_safe(m); ///< protects against early returns
/* register version numbers and constants */
if (PyModule_AddStringConstant(m, "__version__", BOB_EXT_MODULE_VERSION) < 0)
return 0;
/* register the types to python */
Py_INCREF(&PyBobMathLpInteriorPoint_Type);
if (PyModule_AddObject(m, "LPInteriorPoint",
......
......@@ -19,7 +19,7 @@
#endif
#include <bob.blitz/capi.h>
#include <bob.blitz/cleanup.h>
#include <bob.core/config.h>
#include <bob.math/config.h>
static int dict_set(PyObject* d, const char* key, const char* value) {
PyObject* v = Py_BuildValue("s", value);
......@@ -151,6 +151,9 @@ static PyObject* create_module (void) {
if (PyModule_AddStringConstant(m, "module", BOB_EXT_MODULE_VERSION) < 0)
return 0;
if (PyModule_AddIntConstant(m, "api", BOB_MATH_API_VERSION) < 0)
return 0;
PyObject* externals = build_version_dictionary();
if (!externals) return 0;
if (PyModule_AddObject(m, "externals", externals) < 0) return 0;
......
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