NumPy

Previous topic

Packaging (numpy.distutils)

Next topic

numpy.distutils.ccompiler

distutils.misc_util

numpy.distutils.misc_util.get_numpy_include_dirs()[source]
numpy.distutils.misc_util.default_config_dict(name=None, parent_name=None, local_path=None)[source]

Return a configuration dictionary for usage in configuration() function defined in file setup_<name>.py.

numpy.distutils.misc_util.dict_append(d, **kws)[source]
numpy.distutils.misc_util.appendpath(prefix, path)[source]
numpy.distutils.misc_util.generate_config_py(target)[source]

Generate config.py file containing system_info information used during building the package.

Usage:

config[‘py_modules’].append((packagename, ‘__config__’,generate_config_py))

numpy.distutils.misc_util.get_cmd(cmdname, _cache={})[source]
numpy.distutils.misc_util.allpath(name)[source]

Convert a /-separated pathname to one using the OS’s path separator.

numpy.distutils.misc_util.get_mathlibs(path=None)[source]

Return the MATHLIB line from numpyconfig.h

numpy.distutils.misc_util.terminal_has_colors()[source]
numpy.distutils.misc_util.red_text(s)[source]
numpy.distutils.misc_util.green_text(s)[source]
numpy.distutils.misc_util.yellow_text(s)[source]
numpy.distutils.misc_util.blue_text(s)[source]
numpy.distutils.misc_util.cyan_text(s)[source]
numpy.distutils.misc_util.cyg2win32(path)[source]
numpy.distutils.misc_util.mingw32()[source]

Return true when using mingw32 environment.

numpy.distutils.misc_util.all_strings(lst)[source]

Return True if all items in lst are string objects.

numpy.distutils.misc_util.has_f_sources(sources)[source]

Return True if sources contains Fortran files

numpy.distutils.misc_util.has_cxx_sources(sources)[source]

Return True if sources contains C++ files

numpy.distutils.misc_util.filter_sources(sources)[source]

Return four lists of filenames containing C, C++, Fortran, and Fortran 90 module sources, respectively.

numpy.distutils.misc_util.get_dependencies(sources)[source]
numpy.distutils.misc_util.is_local_src_dir(directory)[source]

Return true if directory is local directory.

numpy.distutils.misc_util.get_ext_source_files(ext)[source]
numpy.distutils.misc_util.get_script_files(scripts)[source]
numpy.distutils.misc_util.get_lib_source_files(lib)[source]
numpy.distutils.misc_util.get_data_files(data)[source]
numpy.distutils.misc_util.dot_join(*args)[source]
numpy.distutils.misc_util.get_frame(level=0)[source]

Return frame object from call stack with given level.

numpy.distutils.misc_util.minrelpath(path)[source]

Resolve and ‘.’ from path.

numpy.distutils.misc_util.njoin(*path)[source]

Join two or more pathname components + - convert a /-separated pathname to one using the OS’s path separator. - resolve and from path.

Either passing n arguments as in njoin(‘a’,’b’), or a sequence of n names as in njoin([‘a’,’b’]) is handled, or a mixture of such arguments.

numpy.distutils.misc_util.is_sequence(seq)[source]
numpy.distutils.misc_util.is_string(s)[source]
numpy.distutils.misc_util.as_list(seq)[source]
numpy.distutils.misc_util.gpaths(paths, local_path='', include_non_existing=True)[source]

Apply glob to paths and prepend local_path if needed.

numpy.distutils.misc_util.get_language(sources)[source]

Determine language value (c,f77,f90) from sources

numpy.distutils.misc_util.quote_args(args)[source]
numpy.distutils.misc_util.get_build_architecture()[source]
numpy.distutils.misc_util.get_info(pkgname, dirs=None)[source]

Return an info dict for a given C library.

The info dict contains the necessary options to use the C library.

Parameters
pkgnamestr

Name of the package (should match the name of the .ini file, without the extension, e.g. foo for the file foo.ini).

dirssequence, optional

If given, should be a sequence of additional directories where to look for npy-pkg-config files. Those directories are searched prior to the NumPy directory.

Returns
infodict

The dictionary with build information.

Raises
PkgNotFound

If the package is not found.

Examples

To get the necessary information for the npymath library from NumPy:

>>> npymath_info = np.distutils.misc_util.get_info('npymath')
>>> npymath_info                                    
{'define_macros': [], 'libraries': ['npymath'], 'library_dirs':
['.../numpy/core/lib'], 'include_dirs': ['.../numpy/core/include']}

This info dict can then be used as input to a Configuration instance:

config.add_extension('foo', sources=['foo.c'], extra_info=npymath_info)
numpy.distutils.misc_util.get_pkg_info(pkgname, dirs=None)[source]

Return library info for the given package.

Parameters
pkgnamestr

Name of the package (should match the name of the .ini file, without the extension, e.g. foo for the file foo.ini).

dirssequence, optional

If given, should be a sequence of additional directories where to look for npy-pkg-config files. Those directories are searched prior to the NumPy directory.

Returns
pkginfoclass instance

The LibraryInfo instance containing the build information.

Raises
PkgNotFound

If the package is not found.

numpy.distutils.misc_util.get_num_build_jobs()[source]

Get number of parallel build jobs set by the –parallel command line argument of setup.py If the command did not receive a setting the environment variable NPY_NUM_BUILD_JOBS is checked. If that is unset, return the number of processors on the system, with a maximum of 8 (to prevent overloading the system if there a lot of CPUs).

Returns
outint

number of parallel jobs that can be run