path#

Common path utilities.

Functions#

explode_directories(→ set[str])

get_all_directories(→ list[tuple[str, Ellipsis]])

get_leaf_directories(→ Sequence[str])

tokenized_startswith(test_iterable, startswith_iterable)

get_major_minor_version(string[, with_dot])

get_python_noarch_target_path(source_short_path, ...)

get_python_short_path([python_version])

get_python_site_packages_short_path(python_version)

missing_pyc_files(python_major_minor_version, files)

parse_entry_point_def(ep_definition)

pyc_path(py_path, python_major_minor_version)

This must not return backslashes on Windows as that will break

unix_path_to_win(→ str | tuple[str, Ellipsis] | None)

Convert Unix paths to Windows paths.

win_path_backout(path)

win_path_double_escape(path)

win_path_ok(path)

win_path_to_unix(→ str | tuple[str, Ellipsis] | None)

Convert Windows paths to Unix paths.

explode_directories(child_directories: Iterable[tuple[str, Ellipsis]]) set[str]#
get_all_directories(files: Iterable[str]) list[tuple[str, Ellipsis]]#
get_leaf_directories(files: Iterable[str]) Sequence[str]#
tokenized_startswith(test_iterable, startswith_iterable)#
get_major_minor_version(string, with_dot=True)#
get_python_noarch_target_path(source_short_path, target_site_packages_short_path)#
get_python_short_path(python_version=None)#
get_python_site_packages_short_path(python_version)#
missing_pyc_files(python_major_minor_version, files)#
parse_entry_point_def(ep_definition)#
pyc_path(py_path, python_major_minor_version)#

This must not return backslashes on Windows as that will break tests and leads to an eventual need to make url_to_path return backslashes too and that may end up changing files on disc or to the result of comparisons with the contents of them.

unix_path_to_win(paths: conda.common.path.PathType | conda.common.path.PathsType | None, prefix: conda.common.path.PathType | None = None, *, cygdrive: bool = False) str | tuple[str, Ellipsis] | None#

Convert Unix paths to Windows paths.

Note

Produces unexpected results when run on Unix.

Parameters:
  • paths -- The path(s) to convert.

  • prefix -- The (Windows path-style) prefix directory to use for the conversion. If not provided, no checks for prefix paths will be made.

  • cygdrive -- Unused. Present to keep the signature consistent with win_path_to_unix.

win_path_backout(path)#
win_path_double_escape(path)#
win_path_ok(path)#
win_path_to_unix(paths: conda.common.path.PathType | conda.common.path.PathsType | None, prefix: conda.common.path.PathType | None = None, *, cygdrive: bool = False) str | tuple[str, Ellipsis] | None#

Convert Windows paths to Unix paths.

Note

Produces unexpected results when run on Unix.

Parameters:
  • paths -- The path(s) to convert.

  • prefix -- The (Windows path-style) prefix directory to use for the conversion. If not provided, no checks for prefix paths will be made.

  • cygdrive -- Whether to use the Cygwin-style drive prefix.