# distutils.misc_util

numpy.distutils.misc_util.all_strings(lst)

  Return True if all items in lst are string objects.

numpy.distutils.misc_util.allpath(name)

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

numpy.distutils.misc_util.appendpath(prefix, path)

numpy.distutils.misc_util.as_list(seq)

numpy.distutils.misc_util.blue_text(s)

numpy.distutils.misc_util.cyan_text(s)

numpy.distutils.misc_util.cyg2win32(path: str) → str

  Convert a path from Cygwin-native to Windows-native.

  Uses the cygpath utility (part of the Base install) to do the actual conversion. Falls back to returning the original path if this fails.

  Handles the default `/cygdrive` mount prefix as well as the `/proc/cygdrive` portable prefix, custom cygdrive prefixes such as `/` or `/mnt`, and absolute paths such as `/usr/src/` or `/home/username`

  Parameters
    path str

      The path to convert

  Returns
    converted_path str

      The converted path

  Notes

  Documentation for cygpath utility: https://cygwin.com/cygwin-ug-net/cygpath.html Documentation 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)

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

numpy.distutils.misc_util.dict_append(d, **kws)

numpy.distutils.misc_util.dot_join(*args)

numpy.distutils.misc_util.exec_mod_from_location(modname, modfile)

  Use importlib machinery to import a module modname from the file modfile. Depending on the spec.loader, the module may not be registered in sys.modules.

numpy.distutils.misc_util.filter_sources(sources)

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

numpy.distutils.misc_util.generate_config_py(target)

  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_build_architecture()

numpy.distutils.misc_util.get_cmd(cmdname, _cache={})

numpy.distutils.misc_util.get_data_files(data)

numpy.distutils.misc_util.get_dependencies(sources)

numpy.distutils.misc_util.get_ext_source_files(ext)

numpy.distutils.misc_util.get_frame(level=0)

  Return frame object from call stack with given level.

numpy.distutils.misc_util.get_info(pkgname, dirs=None)

  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).

    dirs sequence, 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
    info dict

      The dictionary with build information.

  Raises
    PkgNotFound

      If the package is not found.

  See also

  `Configuration.add_npy_pkg_config`, `Configuration.add_installed_library`
  `get_pkg_info`

  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_language(sources)

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

numpy.distutils.misc_util.get_lib_source_files(lib)

numpy.distutils.misc_util.get_mathlibs(path=None)

  Return the MATHLIB line from numpyconfig.h

numpy.distutils.misc_util.get_num_build_jobs()

  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
    out int

      number of parallel jobs that can be run

numpy.distutils.misc_util.get_numpy_include_dirs()

numpy.distutils.misc_util.get_pkg_info(pkgname, dirs=None)

  Return library info for the given package.

  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 additional directories where to look for npy-pkg-config files. Those directories are searched prior to the NumPy directory.

  Returns
    pkginfo class instance

      The LibraryInfo instance containing the build information.

  Raises
    PkgNotFound

      If the package is not found.

  See also

  `Configuration.add_npy_pkg_config`, `Configuration.add_installed_library`
  `get_info`

numpy.distutils.misc_util.get_script_files(scripts)

numpy.distutils.misc_util.gpaths(paths, local_path='', include_non_existing=True)

  Apply glob to paths and prepend local_path if needed.

numpy.distutils.misc_util.green_text(s)

numpy.distutils.misc_util.has_cxx_sources(sources)

  Return True if sources contains C++ files

numpy.distutils.misc_util.has_f_sources(sources)

  Return True if sources contains Fortran files

numpy.distutils.misc_util.is_local_src_dir(directory)

  Return true if directory is local directory.

numpy.distutils.misc_util.is_sequence(seq)

numpy.distutils.misc_util.is_string(s)

numpy.distutils.misc_util.mingw32()

  Return true when using mingw32 environment.

numpy.distutils.misc_util.minrelpath(path)

  Resolve and ‘.’ from path.

numpy.distutils.misc_util.njoin(*path)

  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.red_text(s)

numpy.distutils.misc_util.sanitize_cxx_flags(cxxflags)

  Some flags are valid for C but not C++. Prune them.

numpy.distutils.misc_util.terminal_has_colors()

numpy.distutils.misc_util.yellow_text(s)

previous

Packaging (`numpy.distutils`)

next

numpy.distutils.ccompiler