Permalink
Browse files

Merge pull request #123 from jjhelmus/master

ENH: added _debug_info function.
  • Loading branch information...
2 parents d2dd8de + 6db1927 commit 0e4ce70cca12330836648670d94db7a452e39d90 @jjhelmus jjhelmus committed Feb 12, 2014
@@ -0,0 +1,5 @@
+=================
+pyart._debug_info
+=================
+
+.. autofunction:: pyart._debug_info
@@ -16,10 +16,11 @@ Documentation is broken down by directory and module.
.. toctree::
:maxdepth: 2
-
+
io
config
correct
graph
map
testing
+ _debug_info
View
@@ -17,7 +17,8 @@
from . import config
# root level functions
-from config import load_config
+from .config import load_config
+from ._debug_info import _debug_info
# test function setup based on scikit-image test function
import imp as _imp
View
@@ -0,0 +1,134 @@
+"""
+Print out Py-ART version information.
+
+This file can also be run as a script to report on dependencies before a
+build: python pyart/_debug_info.py
+
+"""
+
+from __future__ import print_function
+import os
+import sys
+
+
+def _debug_info(stream=None):
+ """
+ Print out version and status information for debugging.
+
+ This file can be run as a script from the source directory to report on
+ dependecies before a build using: **python pyart/_debug_info.py**.
+
+ Parameters
+ ----------
+ stream : file-like object
+ Stream to print the information to, None prints to sys.stdout.
+
+ """
+ if stream is None:
+ stream = sys.stdout
+
+ # remove the current path from the import search path
+ # if this is not done ./io is found and not the std library io module.
+ current_dir = os.path.dirname(os.path.abspath(__file__))
+ if current_dir in sys.path:
+ sys.path.remove(current_dir)
+
+ try:
+ import pyart
+ pyart_version = pyart.__version__
+ except:
+ pyart_version = "MISSING"
+
+ try:
+ import platform
+ python_version = platform.python_version()
+ except:
+ python_version = "MISSING"
+
+ try:
+ import numpy
+ numpy_version = numpy.__version__
+ except:
+ numpy_version = "MISSING"
+
+ try:
+ import numpy
+ numpy_version = numpy.__version__
+ except:
+ numpy_version = "MISSING"
+
+ try:
+ import scipy
+ scipy_version = scipy.__version__
+ except:
+ scipy_version = "MISSING"
+
+ try:
+ import matplotlib
+ matplotlib_version = matplotlib.__version__
+ except:
+ matplotlib_version = "MISSING"
+
+ try:
+ import netCDF4
+ netCDF4_version = netCDF4.__version__
+ except:
+ netCDF4_version = "MISSING"
+
+ try:
+ rsl_version = pyart.io._rsl_interface._RSL_VERSION_STR
+ except:
+ rsl_version = "MISSING"
+
+ try:
+ import cylp
+ cylp_available = "Available"
+ except:
+ cylp_available = "MISSING"
+
+ try:
+ import glpk
+ glpk_version = "%i.%i" % (glpk.env.version)
+ except:
+ glpk_version = "MISSING"
+
+ try:
+ import cvxopt.info
+ cvxopt_version = cvxopt.info.version
+ except:
+ cvxopt_version = "MISSING"
+
+ try:
+ from mpl_toolkits import basemap
+ basemap_version = basemap.__version__
+ except:
+ basemap_version = "MISSING"
+
+ try:
+ import nose
+ nose_version = nose.__version__
+ except:
+ nose_version = "MISSING"
+
+ print("Py-ART version:", pyart_version, file=stream)
+ print("", file=stream)
+
+ print("---- Dependencies ----", file=stream)
+ print("Python version:", python_version, file=stream)
+ print("NumPy version:", numpy_version, file=stream)
+ print("SciPy version:", scipy_version, file=stream)
+ print("matplotlib version:", matplotlib_version, file=stream)
+ print("netCDF4 version:", netCDF4_version, file=stream)
+ print("", file=stream)
+
+ print("---- Optional dependencies ----", file=stream)
+ print("TRMM RSL version:", rsl_version, file=stream)
+ print("CyLP:", cylp_available, file=stream)
+ print("PyGLPK version:", glpk_version, file=stream)
+ print("CVXOPT version:", cvxopt_version, file=stream)
+ print("basemap version:", basemap_version, file=stream)
+ print("nose version:", nose_version, file=stream)
+
+if __name__ == "__main__":
+
+ _debug_info()
View
@@ -2,6 +2,8 @@
cdef extern from "rsl.h":
+ cdef char[6] _RSL_VERSION_STR "RSL_VERSION_STR"
+
# data structures
ctypedef unsigned short Range
Oops, something went wrong.

0 comments on commit 0e4ce70

Please sign in to comment.