utils
#
Utility functions.
Functions#
|
Convert a path or :-separated string of paths into a Windows representation |
|
|
|
|
|
|
|
Return the number of bytes n in more human readable form. |
Since conda is installed into non-root environments as a symlink only |
|
|
Properly quote arguments for command line passing. |
|
|
|
|
Returns COMSPEC from envvars. |
|
|
Ensures that the directory exists for functions returning |
Attributes#
- unix_path_to_win(path, root_prefix='')#
Convert a path or :-separated string of paths into a Windows representation
Does not add cygdrive. If you need that, set root_prefix to "/cygdrive"
- win_path_to_cygwin(path)#
- cygwin_path_to_win(path)#
- translate_stream(stream, translator)#
- human_bytes(n)#
Return the number of bytes n in more human readable form.
Examples
>>> human_bytes(42) '42 B' >>> human_bytes(1042) '1 KB' >>> human_bytes(10004242) '9.5 MB' >>> human_bytes(100000004242) '93.13 GB'
- _UNIX_SHELL_BASE#
- _MSYS2_SHELL_BASE#
- _SHELLS#
- sys_prefix_unfollowed()#
Since conda is installed into non-root environments as a symlink only and because sys.prefix follows symlinks, this function can be used to get the 'unfollowed' sys.prefix.
This value is usually the same as the prefix of the environment into which conda has been symlinked. An example of when this is necessary is when conda looks for external sub-commands in find_commands.py
- quote_for_shell(*arguments)#
Properly quote arguments for command line passing.
For POSIX uses shlex.join, for Windows uses a custom implementation to properly escape metacharacters.
- _RE_UNSAFE#
- massage_arguments(arguments, errors='assert')#
- wrap_subprocess_call(root_prefix, prefix, dev_mode, debug_wrapper_scripts, arguments, use_system_tmp_path=False)#
- get_comspec()#
Returns COMSPEC from envvars.
Ensures COMSPEC envvar is set to cmd.exe, if not attempt to find it.
- ensure_dir_exists(func)#
Ensures that the directory exists for functions returning a Path object containing a directory