Commit 7e6968aa authored by Tiago Peixoto's avatar Tiago Peixoto

Implement show_config()

This prints useful library information.
parent 36b30534
...@@ -173,9 +173,9 @@ AC_PYTHON_MODULE(numpy, fatal) ...@@ -173,9 +173,9 @@ AC_PYTHON_MODULE(numpy, fatal)
NUMPY_DIR="${PYTHON_SITE_PKG}/numpy" NUMPY_DIR="${PYTHON_SITE_PKG}/numpy"
AC_ARG_WITH([numpy], [AC_HELP_STRING([--with-numpy=DIR], AC_ARG_WITH([numpy], [AC_HELP_STRING([--with-numpy=DIR],
[directory where numpy is installed [directory where numpy is installed
[default=${PYLIBDIR}/numpy] ])], [default=${PYTHON_SITE_PKG}/numpy] ])],
NUMPY_DIR=$withval) NUMPY_DIR=$withval)
NUMPY_DIR="${NUMPY_DIR}/core/include/numpy" [NUMPY_DIR="${NUMPY_DIR}/core/include/numpy"]
AC_CHECK_HEADER([${NUMPY_DIR}/arrayobject.h], AC_CHECK_HEADER([${NUMPY_DIR}/arrayobject.h],
[CPPFLAGS="${CPPFLAGS} -I${NUMPY_DIR}"], [CPPFLAGS="${CPPFLAGS} -I${NUMPY_DIR}"],
[AC_MSG_ERROR([Numpy extension header not found])], [AC_MSG_ERROR([Numpy extension header not found])],
...@@ -186,7 +186,7 @@ AC_PYTHON_MODULE(scipy, fatal) ...@@ -186,7 +186,7 @@ AC_PYTHON_MODULE(scipy, fatal)
[SCIPY_DIR="${PYTHON_SITE_PKG}/scipy"] [SCIPY_DIR="${PYTHON_SITE_PKG}/scipy"]
AC_ARG_WITH([scipy], [AC_HELP_STRING([--with-scipy=DIR], AC_ARG_WITH([scipy], [AC_HELP_STRING([--with-scipy=DIR],
[scipy install directory [scipy install directory
[default=${PYLIBDIR}/scipy] ])], [default=${PYTHON_SITE_PKG}/scipy] ])],
[SCIPY_DIR=$withval]) [SCIPY_DIR=$withval])
AC_CHECK_HEADER([${SCIPY_DIR}/weave/scxx/object.h], AC_CHECK_HEADER([${SCIPY_DIR}/weave/scxx/object.h],
[AC_DEFINE([HAVE_SCIPY], [1], [using scipy's weave])] [AC_DEFINE([HAVE_SCIPY], [1], [using scipy's weave])]
...@@ -232,10 +232,11 @@ AC_SUBST(PACKAGE_DOC_DIR) ...@@ -232,10 +232,11 @@ AC_SUBST(PACKAGE_DOC_DIR)
dnl Subst PYTHON_DIR. dnl Subst PYTHON_DIR.
AC_DEFINE_UNQUOTED([INSTALL_PREFIX],"${prefix}", [python prefix]) AC_DEFINE_UNQUOTED([INSTALL_PREFIX],"${prefix}", [python prefix])
AC_DEFINE_UNQUOTED([PYTHON_DIR], "${PYLIBDIR}", [The directory name for the site-packages subdirectory of the standard Python install tree.]) AC_DEFINE_UNQUOTED([PYTHON_DIR], "${PYTHON_SITE_PKG}", [The directory name for the site-packages subdirectory of the standard Python install tree.])
AC_DEFINE_UNQUOTED([CXXFLAGS],"${CXXFLAGS}", [c++ compilation options]) AC_DEFINE_UNQUOTED([CXXFLAGS],"${CXXFLAGS}", [c++ compilation options])
AC_DEFINE_UNQUOTED([CPPFLAGS],"${CPPFLAGS}", [c++ preprocessor compilation options]) AC_DEFINE_UNQUOTED([CPPFLAGS],"${CPPFLAGS}", [c++ preprocessor compilation options])
AC_DEFINE_UNQUOTED([LDFLAGS],"${LDFLAGS}", [linker options])
AC_DEFINE_UNQUOTED([PACKAGE_DATA_DIR], "${packageprefix}/${packagedatadir}", [package data dir]) AC_DEFINE_UNQUOTED([PACKAGE_DATA_DIR], "${packageprefix}/${packagedatadir}", [package data dir])
AC_DEFINE_UNQUOTED([PACKAGE_DOC_DIR], "${packageprefix}/${packagedocdir}", [package doc dir]) AC_DEFINE_UNQUOTED([PACKAGE_DOC_DIR], "${packageprefix}/${packagedocdir}", [package doc dir])
......
...@@ -45,9 +45,15 @@ struct LibInfo ...@@ -45,9 +45,15 @@ struct LibInfo
string GetVersion() const {return VERSION " (commit " GIT_COMMIT string GetVersion() const {return VERSION " (commit " GIT_COMMIT
", " GIT_COMMIT_DATE ")";} ", " GIT_COMMIT_DATE ")";}
string GetLicense() const {return "GPL version 3 or above";} string GetLicense() const {return "GPL version 3 or above";}
string GetCXXFLAGS() const {return CXXFLAGS " " CPPFLAGS;} string GetCXXFLAGS() const {return CPPFLAGS " " CXXFLAGS " " LDFLAGS;}
string GetInstallPrefix() const {return INSTALL_PREFIX;} string GetInstallPrefix() const {return INSTALL_PREFIX;}
string GetPythonDir() const {return PYTHON_DIR;} string GetPythonDir() const {return PYTHON_DIR;}
string GetGCCVersion() const
{
stringstream s;
s << __GNUC__ << "." << __GNUC_MINOR__ << "." << __GNUC_PATCHLEVEL__;
return s.str();
}
}; };
template <class ValueType> template <class ValueType>
...@@ -288,6 +294,15 @@ string get_graph_type(GraphInterface& g) ...@@ -288,6 +294,15 @@ string get_graph_type(GraphInterface& g)
return name; return name;
} }
bool openmp_enabled()
{
#ifdef USING_OPENMP
return true;
#else
return false;
#endif
}
BOOST_PYTHON_MODULE(libgraph_tool_core) BOOST_PYTHON_MODULE(libgraph_tool_core)
{ {
// numpy // numpy
...@@ -303,6 +318,7 @@ BOOST_PYTHON_MODULE(libgraph_tool_core) ...@@ -303,6 +318,7 @@ BOOST_PYTHON_MODULE(libgraph_tool_core)
class_<boost::any>("any"); class_<boost::any>("any");
def("graph_filtering_enabled", &graph_filtering_enabled); def("graph_filtering_enabled", &graph_filtering_enabled);
def("openmp_enabled", &openmp_enabled);
mpl::for_each<mpl::push_back<scalar_types,string>::type>(export_vector_types()); mpl::for_each<mpl::push_back<scalar_types,string>::type>(export_vector_types());
...@@ -379,7 +395,8 @@ BOOST_PYTHON_MODULE(libgraph_tool_core) ...@@ -379,7 +395,8 @@ BOOST_PYTHON_MODULE(libgraph_tool_core)
.add_property("license", &LibInfo::GetLicense) .add_property("license", &LibInfo::GetLicense)
.add_property("cxxflags", &LibInfo::GetCXXFLAGS) .add_property("cxxflags", &LibInfo::GetCXXFLAGS)
.add_property("install_prefix", &LibInfo::GetInstallPrefix) .add_property("install_prefix", &LibInfo::GetInstallPrefix)
.add_property("python_dir", &LibInfo::GetPythonDir); .add_property("python_dir", &LibInfo::GetPythonDir)
.add_property("gcc_version", &LibInfo::GetGCCVersion);
def("get_graph_type", &get_graph_type); def("get_graph_type", &get_graph_type);
} }
......
...@@ -94,9 +94,10 @@ import scipy.stats ...@@ -94,9 +94,10 @@ import scipy.stats
from . core import __version__, Graph, GraphError, Vector_bool, \ from . core import __version__, Graph, GraphError, Vector_bool, \
Vector_int32_t, Vector_int64_t, Vector_double, Vector_long_double,\ Vector_int32_t, Vector_int64_t, Vector_double, Vector_long_double,\
Vector_string, value_types, load_graph, PropertyMap, Vertex, Edge Vector_string, value_types, load_graph, PropertyMap, Vertex, Edge,\
show_config
__all__ = ["Graph", "Vertex", "Edge", "GraphError", "Vector_bool", __all__ = ["Graph", "Vertex", "Edge", "GraphError", "Vector_bool",
"Vector_int32_t", "Vector_int64_t", "Vector_double", "Vector_int32_t", "Vector_int64_t", "Vector_double",
"Vector_long_double", "Vector_string", "value_types", "load_graph", "Vector_long_double", "Vector_string", "value_types", "load_graph",
"PropertyMap"] "PropertyMap", "show_config"]
...@@ -124,6 +124,16 @@ def _type_alias(type_name): ...@@ -124,6 +124,16 @@ def _type_alias(type_name):
return "vector<%s>" % alias[t] return "vector<%s>" % alias[t]
raise ValueError("invalid property value type: " + type_name) raise ValueError("invalid property value type: " + type_name)
def show_config():
info = libcore.mod_info()
print "version:", info.version
print "gcc version:", info.gcc_version
print "compilation flags:", info.cxxflags
print "install prefix:", info.install_prefix
print "python dir:", info.python_dir
print "graph filtering:", libcore.graph_filtering_enabled()
print "openmp:", libcore.openmp_enabled()
print "uname:", " ".join(os.uname())
################################################################################ ################################################################################
# Property Maps # Property Maps
......
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