Commit bce6f76f authored by André Anjos's avatar André Anjos 💬

Add function to print comprehensive dependence list

parent 74bc3f00
......@@ -2,5 +2,24 @@ from ._library import *
from . import version
from .version import module as __version__
def get_config():
"""Returns a string containing the configuration information.
"""
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('_')]
......@@ -50,13 +50,13 @@ static PyObject* compiler_version() {
f % BOOST_PP_STRINGIZE(__GNUC__);
f % BOOST_PP_STRINGIZE(__GNUC_MINOR__);
f % BOOST_PP_STRINGIZE(__GNUC_PATCHLEVEL__);
return Py_BuildValue("ss", "gcc", f.str().c_str());
return Py_BuildValue("{ssss}", "name", "gcc", "version", f.str().c_str());
# elif defined(__llvm__) && !defined(__clang__)
return Py_BuildValue("ss", "llvm-gcc", __VERSION__);
return Py_BuildValue("{ssss}", "name", "llvm-gcc", "version", __VERSION__);
# elif defined(__clang__)
return Py_BuildValue("ss", "clang", __clang_version__);
return Py_BuildValue("{ssss}", "name", "clang", "version", __clang_version__);
# else
return Py_BuildValue("s", "unsupported");
return Py_BuildValue("{ssss}", "name", "unsupported", "version", "unknown");
# endif
}
......@@ -78,6 +78,14 @@ static PyObject* bob_version() {
return Py_BuildValue("sis", BOB_VERSION, BOB_API_VERSION, BOB_PLATFORM);
}
/**
* Numpy version
*/
static PyObject* numpy_version() {
return Py_BuildValue("{ssss}", "abi", BOOST_PP_STRINGIZE(NPY_VERSION),
"api", BOOST_PP_STRINGIZE(NPY_API_VERSION));
}
static PyObject* build_version_dictionary() {
PyObject* retval = PyDict_New();
......@@ -103,6 +111,11 @@ static PyObject* build_version_dictionary() {
return 0;
}
if (!dict_steal(retval, "NumPy", numpy_version())) {
Py_DECREF(retval);
return 0;
}
return retval;
}
......
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