-
Notifications
You must be signed in to change notification settings - Fork 359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix canonical name for local channels in 1.x #3056
Conversation
cc @jaimergp |
This is one of those moments where one can only say "really?!". 😂 Thanks, I'll double check with conda-libmamba-solver later today! |
Hm, can we add a test? I have applied these changes locally but it doesn't seem to fix the |
Ah, ok, it does work, but there's a gotcha compared to In for d in (
self._croot,
self.bld_path,
self.conda_build.get("root-dir"),
join(self.root_prefix, "conda-bld"),
"~/conda-bld",
) So:
In
So, in order for I've tried redefining mamba/libmamba/src/core/channel.cpp Lines 738 to 758 in 4c012a6
So I wonder if we can add a check to only instantiate the hardcoded Btw, if that were to happen, I think we also need the same fix a few lines below, @isuruf. Just add mamba/libmamba/src/core/channel.cpp Line 780 in 4c012a6
|
|
We could only allow that via the API, not the user configuration. e.g. Line 248 in 4c012a6
(I'm not sure where After all, I just want to inject the customizable Maybe it's a matter of adding the We could also use a secret key name if that's preferred, like |
@jaimergp I'm happy to add any hooks that will let you add what you need (a private |
That would be awesome @AntoinePrv! Whatever's easier from your point of view. |
0d079dc
to
6c85fc4
Compare
return { prefix_params.target_prefix.string() + "/conda-bld", | ||
prefix_params.root_prefix.string() + "/conda-bld", | ||
"~/conda-bld" }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here target_prefix
is used and therefore we can't initialize the variable in the Context creation time and therefore we need to use a getter function here.
@@ -543,6 +543,11 @@ PYBIND11_MODULE(bindings, m) | |||
.def_readwrite("custom_channels", &Context::custom_channels) | |||
.def_readwrite("custom_multichannels", &Context::custom_multichannels) | |||
.def_readwrite("default_channels", &Context::default_channels) | |||
.def_property( | |||
"conda_build_local_paths", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm using conda_build_local_paths
because conda has a read only property with the same name.
This is ready for a review. |
@jaimergp if the setter |
Thanks @JohanMabille, that would be awesome! Let me run a quick test locally to make sure this works with conda-libmamba-solver and I'll give you the thumbs up! |
Ok, conda/conda-libmamba-solver#401 passes locally with this branch so we have a beautiful green! @JohanMabille, you may proceed. Thanks to @isuruf too! |
{ | ||
if (conda_build_local_paths.empty()) | ||
{ | ||
return { prefix_params.target_prefix.string() + "/conda-bld", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if it has been intentional, but this differs from what conda.base.context.conda_build_local_paths
would have:
https://github.com/conda/conda/blob/23.11.0/conda/base/context.py#L505-L523
- This adds non-existent folders whereas
conda
only adds existing ones. bld_path
config value (and as such${CONDA_BLD_PATH}
) is not used.${CONDA_PREFIX}/conda-bld
is added whereasconda
would never add this
(unless it's the root prefix which always considered).conda_build: root-dir
config values is not used.
TBH, I didn't even know that conda_build: root-dir
existed -- and also not that conda-build
uses that config entry but not bld_path
(it only checks the environment variable):
https://github.com/conda/conda-build/blob/3.28.2/conda_build/config.py#L467-L468
So, yeah, the behavior in conda
/conda-build
is a bit convoluted..
But at least the ${CONDA_PREFIX}/conda-bld
addition and ${CONDA_BLD_PATH}
omission here seem rather unexpected to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This keeps the existing paths in mamba with the option to change this from the API. In conda-libmamba-solver
, we set these values from conda's context, so they will be optional. So, if mamba is used from conda-libmamba-solver
, the behaviour will be the same. I agree that it differs when using mamba directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, didn't see @jaimergp's comment in #3056 (comment) which iterates the same points.
So, why do we want different behaviors between the two implementations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This keeps the existing paths in mamba with the option to change this from the API. In
conda-libmamba-solver
, we set these values from conda's context, so they will be optional. So, if mamba is used fromconda-libmamba-solver
, the behaviour will be the same. I agree that it differs when using mamba directly.
I'd consider this behavior a bug in Mamba and not worth preserving...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess in case we assume that we only use this via conda-libmamba-solver
with the value overridden, then it's probably just a thing to change for the 2.x
versions in main
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added #3124 to track this.
Fixes #3055