MCPcopy Create free account
hub / github.com/numpy/numpy / get_info

Function get_info

numpy/distutils/misc_util.py:2210–2268  ·  view source on GitHub ↗

Return an info dict for a given C library. The info dict contains the necessary options to use the C library. 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).

(pkgname, dirs=None)

Source from the content-addressed store, hash-verified

2208 return read_config(pkgname, dirs)
2209
2210def get_info(pkgname, dirs=None):
2211 """
2212 Return an info dict for a given C library.
2213
2214 The info dict contains the necessary options to use the C library.
2215
2216 Parameters
2217 ----------
2218 pkgname : str
2219 Name of the package (should match the name of the .ini file, without
2220 the extension, e.g. foo for the file foo.ini).
2221 dirs : sequence, optional
2222 If given, should be a sequence of additional directories where to look
2223 for npy-pkg-config files. Those directories are searched prior to the
2224 NumPy directory.
2225
2226 Returns
2227 -------
2228 info : dict
2229 The dictionary with build information.
2230
2231 Raises
2232 ------
2233 PkgNotFound
2234 If the package is not found.
2235
2236 See Also
2237 --------
2238 Configuration.add_npy_pkg_config, Configuration.add_installed_library,
2239 get_pkg_info
2240
2241 Examples
2242 --------
2243 To get the necessary information for the npymath library from NumPy:
2244
2245 >>> npymath_info = np.distutils.misc_util.get_info('npymath')
2246 >>> npymath_info #doctest: +SKIP
2247 {'define_macros': [], 'libraries': ['npymath'], 'library_dirs':
2248 ['.../numpy/core/lib'], 'include_dirs': ['.../numpy/core/include']}
2249
2250 This info dict can then be used as input to a `Configuration` instance::
2251
2252 config.add_extension('foo', sources=['foo.c'], extra_info=npymath_info)
2253
2254 """
2255 from numpy.distutils.npy_pkg_config import parse_flags
2256 pkg_info = get_pkg_info(pkgname, dirs)
2257
2258 # Translate LibraryInfo instance into a build_info dict
2259 info = parse_flags(pkg_info.cflags())
2260 for k, v in parse_flags(pkg_info.libs()).items():
2261 info[k].extend(v)
2262
2263 # add_extension extra_info argument is ANAL
2264 info['define_macros'] = info['macros']
2265 del info['macros']
2266 del info['ignored']
2267

Callers 2

get_infoMethod · 0.70

Calls 4

parse_flagsFunction · 0.90
get_pkg_infoFunction · 0.85
cflagsMethod · 0.80
libsMethod · 0.80

Tested by 1