Add search algorithm for environments.txt file (remove hardcoded path) #13724
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
As seem on #13453, the
environments.txt
file is a configuration file that is currently hardcoded to~/.conda/environments.txt
and is one (among many) files responsible for the creation of~/.conda
. This commit tries to reduce the dependency on that directory.The current behavior of
get_user_environments_txt_file
is ambiguous in that it may return a file to write (default behavior) or multiple files to read (during the execution oflist_all_known_prefixes
). This commit adds a search algorithm for it so that it is not written to~/.conda
by default (but it's still able to find it there), and adds a docstring specifying the "file to write" behavior.This commit expands
list_all_known_prefixes
search algorithm to include all config paths specified in https://docs.conda.io/projects/conda/en/latest/user-guide/configuration/use-condarc.html#searching-for-condarc.One should be aware that another user on the same computer may choose to set their
$XDG_CONFIG_HOME
to a value that is different from$HOME/.config
. Since this was not dealt with before (and I'm not sure what should be the expected behavior when one lists environments with admin privileges), I choose not to implement this.Checklist - did you ...
news
directory (using the template) for the next release's release notes? No.