[Numpy-svn] r8577 - branches/1.5.x/numpy/distutils

numpy-svn@scip... numpy-svn@scip...
Sun Aug 1 06:19:44 CDT 2010


Author: rgommers
Date: 2010-08-01 06:19:44 -0500 (Sun, 01 Aug 2010)
New Revision: 8577

Modified:
   branches/1.5.x/numpy/distutils/npy_pkg_config.py
Log:
DOC: wiki merge, add distutils.npy_pkg_config.read_config docstring.

Modified: branches/1.5.x/numpy/distutils/npy_pkg_config.py
===================================================================
--- branches/1.5.x/numpy/distutils/npy_pkg_config.py	2010-08-01 11:10:35 UTC (rev 8576)
+++ branches/1.5.x/numpy/distutils/npy_pkg_config.py	2010-08-01 11:19:44 UTC (rev 8577)
@@ -325,12 +325,12 @@
     if not vars.has_key("pkgdir") and vars.has_key("pkgname"):
         pkgname = vars["pkgname"]
         if not pkgname in sys.modules:
-            raise ValueError("You should import %s to get information on %s" % 
+            raise ValueError("You should import %s to get information on %s" %
                              (pkgname, meta["name"]))
 
         mod = sys.modules[pkgname]
         vars["pkgdir"] = _escape_backslash(os.path.dirname(mod.__file__))
-            
+
     return LibraryInfo(name=meta["name"], description=meta["description"],
             version=meta["version"], sections=sections, vars=VariableSet(vars))
 
@@ -340,6 +340,44 @@
 # problem in practice
 _CACHE = {}
 def read_config(pkgname, dirs=None):
+    """
+    Return library info for a package from its configuration file.
+
+    Parameters
+    ----------
+    pkgname : str
+        Name of the package (should match the name of the .ini file, without
+        the extension, e.g. foo for the file foo.ini).
+    dirs : sequence, optional
+        If given, should be a sequence of directories - usually including
+        the NumPy base directory - where to look for npy-pkg-config files.
+
+    Returns
+    -------
+    pkginfo : class instance
+        The `LibraryInfo` instance containing the build information.
+
+    Raises
+    ------
+    PkgNotFound
+        If the package is not found.
+
+    See Also
+    --------
+    misc_util.get_info, misc_util.get_pkg_info
+
+    Examples
+    --------
+    >>> npymath_info = np.distutils.npy_pkg_config.read_config('npymath')
+    >>> type(npymath_info)
+    <class 'numpy.distutils.npy_pkg_config.LibraryInfo'>
+    >>> print npymath_info
+    Name: npymath
+    Description: Portable, core math library implementing C99 standard
+    Requires:
+    Version: 0.1  #random
+
+    """
     try:
         return _CACHE[pkgname]
     except KeyError:



More information about the Numpy-svn mailing list