Skip to content
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

Wired up register_envs flag #2806

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion libmamba/include/mamba/core/channel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@

namespace mamba
{
std::vector<std::string> get_known_platforms();
const std::vector<std::string>& get_known_platforms();

// Note: Channels can only be created using ChannelContext.
class Channel
{
Expand Down
8 changes: 8 additions & 0 deletions libmamba/src/api/configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1137,6 +1137,14 @@ namespace mamba
.set_post_merge_hook(detail::envs_dirs_hook)
.description("Possible locations of named environments"));

insert(Configurable("register_envs", &ctx.register_envs)
.group("Basic")
.set_rc_configurable()
.set_env_var_names({ "CONDA_REGISTER_ENVS" })
.needs({ "root_prefix" })
.description("whether to add the newly created prefix to ~/.conda/environments.txt"
));

insert(Configurable("pkgs_dirs", &ctx.pkgs_dirs)
.group("Basic")
.set_rc_configurable()
Expand Down
2 changes: 1 addition & 1 deletion libmamba/src/core/channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ namespace mamba
}
} // namespace

std::vector<std::string> get_known_platforms()
const std::vector<std::string>& get_known_platforms()
{
return KNOWN_PLATFORMS;
}
Expand Down
8 changes: 8 additions & 0 deletions libmambapy/libmambapy/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,14 @@ class Context:
def quiet(self, arg1: bool) -> None:
pass
@property
def register_envs(self) -> bool:
"""
:type: bool
"""
@register_envs.setter
def register_envs(self, arg0: bool) -> None:
pass
@property
def remote_fetch_params(self) -> Context.RemoteFetchParams:
"""
:type: Context.RemoteFetchParams
Expand Down
1 change: 1 addition & 0 deletions libmambapy/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ PYBIND11_MODULE(bindings, m)
.def_readwrite("always_yes", &Context::always_yes)
.def_readwrite("dry_run", &Context::dry_run)
.def_readwrite("download_only", &Context::download_only)
.def_readwrite("register_envs", &Context::register_envs)
.def_readwrite("add_pip_as_python_dependency", &Context::add_pip_as_python_dependency)
.def_readwrite("envs_dirs", &Context::envs_dirs)
.def_readwrite("pkgs_dirs", &Context::pkgs_dirs)
Expand Down
13 changes: 13 additions & 0 deletions micromamba/src/common_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,3 +452,16 @@ init_install_options(CLI::App* subcom, Configuration& config)
"Categories of package to install from environment lockfile"
);
}

void
init_create_options(CLI::App* subcom, Configuration& config)
{
init_install_options(subcom, config);

auto& register_envs = config.at("register_envs");
subcom->add_flag(
"--register-envs",
register_envs.get_cli_config<bool>(),
register_envs.description()
);
}
3 changes: 3 additions & 0 deletions micromamba/src/common_options.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ init_prefix_options(CLI::App* subcom, mamba::Configuration& config);
void
init_install_options(CLI::App* subcom, mamba::Configuration& config);

void
init_create_options(CLI::App* subcom, mamba::Configuration& config);

void
init_network_options(CLI::App* subcom, mamba::Configuration& config);

Expand Down
2 changes: 1 addition & 1 deletion micromamba/src/create.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ using namespace mamba; // NOLINT(build/namespaces)
void
set_create_command(CLI::App* subcom, Configuration& config)
{
init_install_options(subcom, config);
init_create_options(subcom, config);

subcom->callback([&] { return mamba::create(config); });
}