distutils.misc_util#
- numpy.distutils.misc_util.all_strings(lst)[source]#
Return True if all items in lst are string objects.
- numpy.distutils.misc_util.allpath(name)[source]#
Convert a /-separated pathname to one using the OS’s path separator.
- numpy.distutils.misc_util.cyg2win32(path:str)→str[source]#
Convert a path from Cygwin-native to Windows-native.
Uses the cygpath utility (part of the Base install) to do theactual conversion. Falls back to returning the original path ifthis fails.
Handles the default
/cygdrivemount prefix as well as the/proc/cygdriveportable prefix, custom cygdrive prefixes suchas/or/mnt, and absolute paths such as/usr/src/or/home/username- Parameters:
- pathstr
The path to convert
- Returns:
- converted_pathstr
The converted path
Notes
Documentation for cygpath utility:https://cygwin.com/cygwin-ug-net/cygpath.htmlDocumentation for the C function it wraps:https://cygwin.com/cygwin-api/func-cygwin-conv-path.html
- numpy.distutils.misc_util.default_config_dict(name=None,parent_name=None,local_path=None)[source]#
Return a configuration dictionary for usage inconfiguration() function defined in file setup_<name>.py.
- numpy.distutils.misc_util.exec_mod_from_location(modname,modfile)[source]#
Use importlib machinery to import a modulemodname from the filemodfile. Depending on thespec.loader, the module may not beregistered in sys.modules.
- numpy.distutils.misc_util.filter_sources(sources)[source]#
Return four lists of filenames containingC, C++, Fortran, and Fortran 90 module sources,respectively.
- numpy.distutils.misc_util.generate_config_py(target)[source]#
Generate config.py file containing system_info informationused during building the package.
- Usage:
config[‘py_modules’].append((packagename, ‘__config__’,generate_config_py))
- numpy.distutils.misc_util.get_frame(level=0)[source]#
Return frame object from call stack with given level.
- 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, withoutthe extension, e.g. foo for the file foo.ini).
- dirssequence, optional
If given, should be a sequence of additional directories where to lookfor npy-pkg-config files. Those directories are searched prior to theNumPy 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
Configurationinstance:config.add_extension('foo',sources=['foo.c'],extra_info=npymath_info)
- numpy.distutils.misc_util.get_language(sources)[source]#
Determine language value (c,f77,f90) from sources
- numpy.distutils.misc_util.get_mathlibs(path=None)[source]#
Return the MATHLIB line from numpyconfig.h
- numpy.distutils.misc_util.get_num_build_jobs()[source]#
Get number of parallel build jobs set by the –parallel command lineargument of setup.pyIf the command did not receive a setting the environment variableNPY_NUM_BUILD_JOBS is checked. If that is unset, return the number ofprocessors on the system, with a maximum of 8 (to preventoverloading the system if there a lot of CPUs).
- Returns:
- outint
number of parallel jobs that can be run
- 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, withoutthe extension, e.g. foo for the file foo.ini).
- dirssequence, optional
If given, should be a sequence of additional directories where to lookfor npy-pkg-config files. Those directories are searched prior to theNumPy directory.
- Returns:
- pkginfoclass instance
TheLibraryInfo instance containing the build information.
- Raises:
- PkgNotFound
If the package is not found.
- 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.has_cxx_sources(sources)[source]#
Return True if sources contains C++ files
- numpy.distutils.misc_util.has_f_sources(sources)[source]#
Return True if sources contains Fortran files
- numpy.distutils.misc_util.is_local_src_dir(directory)[source]#
Return true if directory is local directory.
- 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 sequenceof n names as in njoin([‘a’,’b’]) is handled, or a mixture of such arguments.