Skip to content

Conversation

@ericpre
Copy link
Contributor

@ericpre ericpre commented Jan 26, 2021

Fixes conda-forge/miniforge#44.

Currently, when there is a .condarc in the root prefix and no user .condarc, setting configuration parameter will use the default values hard-coded in conda - defined in conda.base.constant.
This is not an issue with anaconda/miniconda distribution, since these hard-coded defaults matches the expectation of these distributions, however, this is an issue for distribution for example, because the .condarc provided to constructor is not honoured. An example of this issue is demonstrated in conda-forge/miniforge#44 (comment), where the defaults channels are added but obviously this would also applied to any other configuration parameter.

This PR simply fixes the issue by loading the .condarc present in the root prefix (if present) when no other .condarc have been found.

…arc. If the former doesn't exist use conda defaults config.
@ericpre ericpre requested a review from a team as a code owner January 26, 2021 11:26
@anaconda-issue-bot anaconda-issue-bot added the cla-signed [bot] added once the contributor has signed the CLA label Jan 26, 2021
@ericpre
Copy link
Contributor Author

ericpre commented Feb 8, 2021

@chenghlee, @cjmartian, any chance to review this PR?

I don't understand what is the purpose of the following lines:

conda/conda/base/context.py

Lines 700 to 706 in e37cf84

# add 'defaults' channel when necessary if --channel is given via the command line
if self._argparse_args and 'channel' in self._argparse_args:
# TODO: it's args.channel right now, not channels
argparse_channels = tuple(self._argparse_args['channel'] or ())
if argparse_channels and argparse_channels == self._channels:
return tuple(IndexedSet(concatv(local_add, argparse_channels,
(DEFAULTS_CHANNEL_NAME,))))

This is adding the defaults channel when using calling conda install package -c conda-forge when conda-forge is the only channel in the .condarc.

@isuruf
Copy link
Contributor

isuruf commented Feb 24, 2021

ping

@ericpre
Copy link
Contributor Author

ericpre commented Mar 28, 2021

@chenghlee, @cjmartian, any hope to have this PR considered? It is a simple bug fix.

Copy link
Contributor

@cjmartian cjmartian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems fine to me. I think it's worth double checking with @chenghlee but from what I can tell it looks good.

…ondarc

# Conflicts:
#	tests/cli/test_config.py
@ericpre
Copy link
Contributor Author

ericpre commented Mar 28, 2021

Thanks for the reply, I have fixed the merge conflict!

@chenghlee chenghlee modified the milestones: Release TBD, 4.10.0 Mar 29, 2021
@github-actions
Copy link

github-actions bot commented Apr 5, 2022

Hi there, thank you for your contribution!

This pull request has been automatically locked because it has not had recent activity after being closed.

Please open a new issue or pull request if needed.

Thanks!

@github-actions github-actions bot added the locked [bot] locked due to inactivity label Apr 5, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla-signed [bot] added once the contributor has signed the CLA locked [bot] locked due to inactivity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Anaconda default channel seems to be added

5 participants