# skbuild.utils package

This module defines functions generally useful in scikit-build.

class skbuild.utils.CommonLog(*args, **kwargs)

  Bases: `Protocol`

  Protocol for loggers with an info method.

  info(_CommonLog__msg: str, *args: object) → None

class skbuild.utils.Distribution(script_name: str)

  Bases: `NamedTuple`

  Distribution stand-in.

  script_name: str

    Alias for field number 0

class skbuild.utils.PythonModuleFinder(packages: Sequence[str], package_dir: Mapping[str, str], py_modules: Sequence[str], alternative_build_base: str | None = None)

  Bases: `build_py`

  Convenience class to search for python modules.

  This class is based on `distutils.command.build_py.build_by` and provides a specialized version of `find_all_modules()`.

  check_module(module: str, module_file: str) → bool

    Return True if `module_file` belongs to `module`.

  distribution: Distribution
  find_all_modules(project_dir: str | None = None) → list[Any | tuple[str, str, str]]

    Compute the list of all modules that would be built by project located in current directory, whether they are specified one-module-at-a-time `py_modules` or by whole packages `packages`.

    By default, the function will search for modules in the current directory. Specifying `project_dir` parameter allow to change this.

    Return a list of tuples `(package, module, module_file)`.

  find_package_modules(package: str, package_dir: str) → Iterable[tuple[str, str, str]]

    Temporally prepend the `alternative_build_base` to `module_file`. Doing so will ensure modules can also be found in other location (e.g `skbuild.constants.CMAKE_INSTALL_DIR`).

skbuild.utils.distribution_hide_listing(distribution: Distribution | Distribution) → Iterator[bool | int]

  Given a `distribution`, this context manager temporarily sets distutils threshold to WARN if `--hide-listing` argument was provided.

  It yields True if `--hide-listing` argument was provided.

skbuild.utils.mkdir_p(path: str) → None

  Ensure directory `path` exists. If needed, parent directories are created.

skbuild.utils.parse_manifestin(template: str) → list[str]

  This function parses template file (usually MANIFEST.in)

class skbuild.utils.push_dir(directory: str | None = None, make_directory: bool = False)

  Bases: `ContextDecorator`

  Context manager to change current directory.

  old_cwd: str | None

skbuild.utils.to_platform_path(path: OptStr) → OptStr

  Return a version of `path` where all separator are `os.sep`

skbuild.utils.to_unix_path(path: OptStr) → OptStr

  Return a version of `path` where all separator are `/`