mirror of https://github.com/mamba-org/mamba.git
Remove banner (#2298)
This commit is contained in:
parent
30235eec08
commit
0a7490c940
|
@ -22,18 +22,6 @@ namespace mamba
|
|||
void info(Configuration& config);
|
||||
|
||||
std::string version();
|
||||
std::string banner();
|
||||
|
||||
const std::string mamba_banner = std::string(strip(
|
||||
R"MAMBARAW(
|
||||
__
|
||||
_____ ___ ____ _____ ___ / /_ ____ _
|
||||
/ __ `__ \/ __ `/ __ `__ \/ __ \/ __ `/
|
||||
/ / / / / / /_/ / / / / / / /_/ / /_/ /
|
||||
/_/ /_/ /_/\__,_/_/ /_/ /_/_.___/\__,_/
|
||||
)MAMBARAW",
|
||||
'\n'
|
||||
));
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
|
|
@ -166,7 +166,6 @@ namespace mamba
|
|||
std::string caller_version{ "" };
|
||||
std::string conda_version{ "3.8.0" };
|
||||
std::string current_command{ "mamba" };
|
||||
std::string custom_banner{ "" };
|
||||
bool is_micromamba{ false };
|
||||
};
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ namespace mamba
|
|||
void config_describe(Configuration& config)
|
||||
{
|
||||
config.at("use_target_prefix_fallback").set_value(true);
|
||||
config.at("show_banner").set_value(false);
|
||||
config.at("target_prefix_checks")
|
||||
.set_value(
|
||||
MAMBA_ALLOW_EXISTING_PREFIX | MAMBA_ALLOW_MISSING_PREFIX
|
||||
|
@ -38,7 +37,6 @@ namespace mamba
|
|||
void config_list(Configuration& config)
|
||||
{
|
||||
config.at("use_target_prefix_fallback").set_value(true);
|
||||
config.at("show_banner").set_value(false);
|
||||
config.at("target_prefix_checks")
|
||||
.set_value(
|
||||
MAMBA_ALLOW_EXISTING_PREFIX | MAMBA_ALLOW_MISSING_PREFIX
|
||||
|
@ -70,7 +68,6 @@ namespace mamba
|
|||
void config_sources(Configuration& config)
|
||||
{
|
||||
config.at("use_target_prefix_fallback").set_value(true);
|
||||
config.at("show_banner").set_value(false);
|
||||
config.at("target_prefix_checks")
|
||||
.set_value(
|
||||
MAMBA_ALLOW_EXISTING_PREFIX | MAMBA_ALLOW_MISSING_PREFIX
|
||||
|
|
|
@ -1652,14 +1652,6 @@ namespace mamba
|
|||
)
|
||||
.description("Print the context after loading the config. Allow ultra-dry runs"));
|
||||
|
||||
insert(Configurable("show_banner", true)
|
||||
.group("Output, Prompt and Flow Control")
|
||||
.set_rc_configurable()
|
||||
.set_env_var_names()
|
||||
.needs({ "quiet", "json" })
|
||||
.set_single_op_lifetime()
|
||||
.description("Show the banner"));
|
||||
|
||||
insert(Configurable("show_all_configs", false)
|
||||
.group("Output, Prompt and Flow Control")
|
||||
.description("Display all configs, including not rc configurable"));
|
||||
|
@ -1859,11 +1851,6 @@ namespace mamba
|
|||
exit(0);
|
||||
}
|
||||
|
||||
if (at("show_banner").value<bool>())
|
||||
{
|
||||
Console::instance().print(banner());
|
||||
}
|
||||
|
||||
auto& ctx = Context::instance();
|
||||
ctx.set_log_level(ctx.output_params.logging_level);
|
||||
|
||||
|
|
|
@ -36,13 +36,6 @@ namespace mamba
|
|||
config.operation_teardown();
|
||||
}
|
||||
|
||||
std::string banner()
|
||||
{
|
||||
auto& ctx = Context::instance();
|
||||
return ctx.command_params.custom_banner.empty() ? mamba_banner
|
||||
: ctx.command_params.custom_banner;
|
||||
}
|
||||
|
||||
namespace detail
|
||||
{
|
||||
void info_pretty_print(std::vector<std::tuple<std::string, nlohmann::json>> items)
|
||||
|
|
|
@ -17,7 +17,6 @@ namespace mamba
|
|||
{
|
||||
void list(Configuration& config, const std::string& regex)
|
||||
{
|
||||
config.at("show_banner").set_value(false);
|
||||
config.at("use_target_prefix_fallback").set_value(true);
|
||||
config.at("target_prefix_checks")
|
||||
.set_value(
|
||||
|
|
|
@ -27,7 +27,6 @@ namespace mamba
|
|||
{
|
||||
auto& ctx = Context::instance();
|
||||
|
||||
config.at("show_banner").set_value(false);
|
||||
config.at("use_target_prefix_fallback").set_value(true);
|
||||
config.at("target_prefix_checks")
|
||||
.set_value(MAMBA_ALLOW_EXISTING_PREFIX | MAMBA_ALLOW_MISSING_PREFIX);
|
||||
|
|
|
@ -37,7 +37,6 @@ namespace mamba
|
|||
m_channel_alias_bu = ctx.channel_alias;
|
||||
m_ssl_verify = ctx.remote_fetch_params.ssl_verify;
|
||||
m_proxy_servers = ctx.proxy_servers;
|
||||
config.at("show_banner").set_default_value(false);
|
||||
}
|
||||
|
||||
~Configuration()
|
||||
|
@ -62,7 +61,6 @@ namespace mamba
|
|||
|
||||
config.reset_configurables();
|
||||
config.at("rc_files").set_value<std::vector<fs::u8path>>({ unique_location });
|
||||
config.at("show_banner").set_default_value(false);
|
||||
config.load();
|
||||
}
|
||||
|
||||
|
@ -85,7 +83,6 @@ namespace mamba
|
|||
|
||||
config.reset_configurables();
|
||||
config.at("rc_files").set_value(sources);
|
||||
config.at("show_banner").set_default_value(false);
|
||||
config.load();
|
||||
}
|
||||
|
||||
|
|
|
@ -20,5 +20,5 @@ dependencies:
|
|||
- fmt
|
||||
- pybind11
|
||||
- pybind11-stubgen
|
||||
- pytest
|
||||
- pytest >=7.3
|
||||
- sel(win): winreg
|
||||
|
|
|
@ -6,7 +6,6 @@ __all__ = [
|
|||
"Channel",
|
||||
"ChannelPriority",
|
||||
"CompressedProblemsGraph",
|
||||
"Configuration",
|
||||
"Context",
|
||||
"DownloadTargetList",
|
||||
"ExtraPkgInfo",
|
||||
|
@ -381,18 +380,6 @@ class CompressedProblemsGraph:
|
|||
def tree_message(self) -> str: ...
|
||||
pass
|
||||
|
||||
class Configuration:
|
||||
def __init__(self) -> None: ...
|
||||
@property
|
||||
def show_banner(self) -> bool:
|
||||
"""
|
||||
:type: bool
|
||||
"""
|
||||
@show_banner.setter
|
||||
def show_banner(self, arg1: bool) -> None:
|
||||
pass
|
||||
pass
|
||||
|
||||
class Context:
|
||||
class OutputParams:
|
||||
def __init__(self) -> None: ...
|
||||
|
|
|
@ -963,18 +963,6 @@ PYBIND11_MODULE(bindings, m)
|
|||
|
||||
m.def("clean", [](int flags) { return clean(mambapy::singletons().config, flags); });
|
||||
|
||||
py::class_<Configuration, std::unique_ptr<Configuration, py::nodelete>>(m, "Configuration")
|
||||
.def(py::init(
|
||||
[]()
|
||||
{ return std::unique_ptr<Configuration, py::nodelete>(&mambapy::singletons().config); }
|
||||
))
|
||||
.def_property(
|
||||
"show_banner",
|
||||
[]() -> bool { return mambapy::singletons().config.at("show_banner").value<bool>(); },
|
||||
[](py::object&, bool val)
|
||||
{ mambapy::singletons().config.at("show_banner").set_value(val); }
|
||||
);
|
||||
|
||||
m.def(
|
||||
"get_channels",
|
||||
[](const std::vector<std::string>& channel_names)
|
||||
|
|
|
@ -22,7 +22,7 @@ dependencies:
|
|||
- pip
|
||||
- pybind11
|
||||
- pybind11-stubgen
|
||||
- pytest
|
||||
- pytest >=7.3
|
||||
- pyyaml
|
||||
- conda
|
||||
- conda-content-trust
|
||||
|
|
|
@ -71,30 +71,6 @@ else:
|
|||
log = getLogger(__name__)
|
||||
stderrlog = getLogger("conda.stderr")
|
||||
|
||||
banner = f"""
|
||||
__ __ __ __
|
||||
/ \\ / \\ / \\ / \\
|
||||
/ \\/ \\/ \\/ \\
|
||||
███████████████/ /██/ /██/ /██/ /████████████████████████
|
||||
/ / \\ / \\ / \\ / \\ \\____
|
||||
/ / \\_/ \\_/ \\_/ \\ o \\__,
|
||||
/ _/ \\_____/ `
|
||||
|/
|
||||
███╗ ███╗ █████╗ ███╗ ███╗██████╗ █████╗
|
||||
████╗ ████║██╔══██╗████╗ ████║██╔══██╗██╔══██╗
|
||||
██╔████╔██║███████║██╔████╔██║██████╔╝███████║
|
||||
██║╚██╔╝██║██╔══██║██║╚██╔╝██║██╔══██╗██╔══██║
|
||||
██║ ╚═╝ ██║██║ ██║██║ ╚═╝ ██║██████╔╝██║ ██║
|
||||
╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝
|
||||
|
||||
mamba ({mamba.__version__}) supported by @QuantStack
|
||||
|
||||
GitHub: https://github.com/mamba-org/mamba
|
||||
Twitter: https://twitter.com/QuantStack
|
||||
|
||||
█████████████████████████████████████████████████████████████
|
||||
"""
|
||||
|
||||
|
||||
class MambaException(Exception):
|
||||
pass
|
||||
|
@ -719,7 +695,6 @@ def clean(args, parser):
|
|||
api.Context().prefix_params.root_prefix
|
||||
)
|
||||
|
||||
api.Configuration().show_banner = False
|
||||
api.clean(api.MAMBA_CLEAN_LOCKS)
|
||||
if root_prefix:
|
||||
os.environ["MAMBA_ROOT_PREFIX"] = root_prefix
|
||||
|
@ -893,10 +868,8 @@ def _wrapped_main(*args, **kwargs):
|
|||
args.remove("--mamba-experimental")
|
||||
|
||||
if "--no-banner" in args:
|
||||
# Backwards compat (banner was removed)
|
||||
args.remove("--no-banner")
|
||||
found_no_banner = True
|
||||
else:
|
||||
found_no_banner = False
|
||||
|
||||
p = generate_parser()
|
||||
configure_clean_locks(p._subparsers._group_actions[0])
|
||||
|
@ -906,14 +879,6 @@ def _wrapped_main(*args, **kwargs):
|
|||
context.__init__(argparse_args=parsed_args)
|
||||
context.__initialized__ = True
|
||||
|
||||
if (
|
||||
not found_no_banner
|
||||
and os.isatty(sys.stdout.fileno())
|
||||
and not context.quiet
|
||||
and not ("MAMBA_NO_BANNER" in os.environ or parsed_args.cmd in ("list", "run"))
|
||||
):
|
||||
print(banner, file=sys.stderr)
|
||||
|
||||
init_loggers(context)
|
||||
|
||||
result = do_call(parsed_args, p)
|
||||
|
|
|
@ -17,9 +17,7 @@ dependencies:
|
|||
- reproc-cpp
|
||||
- yaml-cpp
|
||||
- cli11 >=2.2
|
||||
# Pin Pytest while pytest-xprocess relies on removed features
|
||||
# https://github.com/pytest-dev/pytest-xprocess/issues/110
|
||||
- pytest <7.2.0
|
||||
- pytest >=7.3.0
|
||||
- pytest-asyncio
|
||||
- pytest-lazy-fixture
|
||||
- pytest-xprocess
|
||||
|
|
|
@ -33,7 +33,6 @@ complete_options(
|
|||
|
||||
if (last_args[0] == "-n" && last_args.size() == 2)
|
||||
{
|
||||
config.at("show_banner").set_value(false);
|
||||
config.load();
|
||||
|
||||
auto root_prefix = config.at("root_prefix").value<fs::u8path>();
|
||||
|
|
|
@ -297,7 +297,6 @@ void
|
|||
set_sequence_to_rc(mamba::Configuration& config, const SequenceAddType& opt)
|
||||
{
|
||||
config.at("use_target_prefix_fallback").set_value(true);
|
||||
config.at("show_banner").set_value(false);
|
||||
config.at("target_prefix_checks")
|
||||
.set_value(
|
||||
MAMBA_ALLOW_EXISTING_PREFIX | MAMBA_ALLOW_MISSING_PREFIX | MAMBA_ALLOW_NOT_ENV_PREFIX
|
||||
|
@ -352,7 +351,6 @@ set_config_remove_key_command(CLI::App* subcom, mamba::Configuration& config)
|
|||
[&]()
|
||||
{
|
||||
config.at("use_target_prefix_fallback").set_value(true);
|
||||
config.at("show_banner").set_value(false);
|
||||
config.at("target_prefix_checks")
|
||||
.set_value(
|
||||
MAMBA_ALLOW_EXISTING_PREFIX | MAMBA_ALLOW_MISSING_PREFIX
|
||||
|
@ -416,7 +414,6 @@ set_config_remove_command(CLI::App* subcom, mamba::Configuration& config)
|
|||
[&]
|
||||
{
|
||||
config.at("use_target_prefix_fallback").set_value(true);
|
||||
config.at("show_banner").set_value(false);
|
||||
config.at("target_prefix_checks")
|
||||
.set_value(
|
||||
MAMBA_ALLOW_EXISTING_PREFIX | MAMBA_ALLOW_MISSING_PREFIX
|
||||
|
@ -494,7 +491,6 @@ set_config_set_command(CLI::App* subcom, mamba::Configuration& config)
|
|||
[&]
|
||||
{
|
||||
config.at("use_target_prefix_fallback").set_value(true);
|
||||
config.at("show_banner").set_value(false);
|
||||
config.at("target_prefix_checks")
|
||||
.set_value(
|
||||
MAMBA_ALLOW_EXISTING_PREFIX | MAMBA_ALLOW_MISSING_PREFIX
|
||||
|
@ -540,7 +536,6 @@ set_config_get_command(CLI::App* subcom, mamba::Configuration& config)
|
|||
[&]
|
||||
{
|
||||
config.at("use_target_prefix_fallback").set_value(true);
|
||||
config.at("show_banner").set_value(false);
|
||||
config.at("target_prefix_checks")
|
||||
.set_value(
|
||||
MAMBA_ALLOW_EXISTING_PREFIX | MAMBA_ALLOW_MISSING_PREFIX
|
||||
|
|
|
@ -70,7 +70,6 @@ set_constructor_command(CLI::App* subcom, mamba::Configuration& config)
|
|||
void
|
||||
construct(Configuration& config, const fs::u8path& prefix, bool extract_conda_pkgs, bool extract_tarball)
|
||||
{
|
||||
config.at("show_banner").set_value(false);
|
||||
config.at("use_target_prefix_fallback").set_value(true);
|
||||
config.at("target_prefix_checks")
|
||||
.set_value(
|
||||
|
|
|
@ -78,10 +78,8 @@ set_env_command(CLI::App* com, Configuration& config)
|
|||
[&]
|
||||
{
|
||||
auto const& ctx = Context::instance();
|
||||
config.at("show_banner").set_value(false);
|
||||
config.load();
|
||||
|
||||
|
||||
mamba::ChannelContext channel_context;
|
||||
if (explicit_format)
|
||||
{
|
||||
|
|
|
@ -40,7 +40,6 @@ main(int argc, char** argv)
|
|||
auto& ctx = Context::instance();
|
||||
|
||||
ctx.command_params.is_micromamba = true;
|
||||
ctx.command_params.custom_banner = banner;
|
||||
|
||||
CLI::App app{ "Version: " + version() + "\n" };
|
||||
set_umamba_command(&app, config);
|
||||
|
|
|
@ -178,7 +178,6 @@ set_run_command(CLI::App* subcom, Configuration& config)
|
|||
subcom->callback(
|
||||
[&config, subcom, stream_option]()
|
||||
{
|
||||
config.at("show_banner").set_value(false);
|
||||
config.load();
|
||||
|
||||
std::vector<std::string> command = subcom->remaining();
|
||||
|
|
|
@ -190,8 +190,7 @@ run_server(int port, mamba::ChannelContext& channel_context, Configuration& conf
|
|||
{
|
||||
res.type = "text/plain";
|
||||
std::stringstream ss;
|
||||
ss << banner << "\n\n"
|
||||
<< "Version " << UMAMBA_VERSION_STRING << "\n";
|
||||
ss << "Micromamba version " << UMAMBA_VERSION_STRING << "\n";
|
||||
res.send(ss.str());
|
||||
}
|
||||
);
|
||||
|
|
|
@ -103,7 +103,6 @@ namespace
|
|||
|
||||
void set_default_config_options(Configuration& config)
|
||||
{
|
||||
config.at("show_banner").set_value(false);
|
||||
config.at("use_target_prefix_fallback").set_value(false);
|
||||
config.at("target_prefix_checks").set_value(MAMBA_NO_PREFIX_CHECK);
|
||||
}
|
||||
|
|
|
@ -10,15 +10,6 @@
|
|||
#include <CLI/CLI.hpp>
|
||||
|
||||
|
||||
const char banner[] = R"MAMBARAW(
|
||||
__
|
||||
__ ______ ___ ____ _____ ___ / /_ ____ _
|
||||
/ / / / __ `__ \/ __ `/ __ `__ \/ __ \/ __ `/
|
||||
/ /_/ / / / / / / /_/ / / / / / / /_/ / /_/ /
|
||||
/ .___/_/ /_/ /_/\__,_/_/ /_/ /_/_.___/\__,_/
|
||||
/_/
|
||||
)MAMBARAW";
|
||||
|
||||
void
|
||||
set_clean_command(CLI::App* subcom, mamba::Configuration& config);
|
||||
|
||||
|
|
|
@ -175,7 +175,7 @@ class TestConfigList:
|
|||
@pytest.mark.parametrize("rc_file_args", ({"channels": ["channel1", "channel2"]},))
|
||||
def test_list_with_rc(self, rc_file, rc_file_text):
|
||||
assert (
|
||||
config("list", "--no-env", "--rc-file", rc_file).splitlines()[:-1]
|
||||
config("list", "--no-env", "--rc-file", rc_file).splitlines()
|
||||
== rc_file_text.splitlines()
|
||||
)
|
||||
|
||||
|
@ -188,9 +188,7 @@ class TestConfigList:
|
|||
home_folder = os.path.expanduser("~")
|
||||
src = f" # '{str(rc_file).replace(home_folder, '~')}'"
|
||||
assert (
|
||||
config("list", "--no-env", "--rc-file", rc_file, source_flag).splitlines()[
|
||||
:-1
|
||||
]
|
||||
config("list", "--no-env", "--rc-file", rc_file, source_flag).splitlines()
|
||||
== f"channels:\n - channel1{src}\n - channel2{src}\n".splitlines()
|
||||
)
|
||||
|
||||
|
@ -198,9 +196,7 @@ class TestConfigList:
|
|||
@pytest.mark.parametrize("rc_file_args", ({"channels": ["channel1", "channel2"]},))
|
||||
def test_list_with_descriptions(self, rc_file, desc_flag):
|
||||
assert (
|
||||
config("list", "--no-env", "--rc-file", rc_file, desc_flag).splitlines()[
|
||||
:-4
|
||||
]
|
||||
config("list", "--no-env", "--rc-file", rc_file, desc_flag).splitlines()
|
||||
== "# channels\n# Define the list of channels\nchannels:\n"
|
||||
" - channel1\n - channel2\n".splitlines()
|
||||
)
|
||||
|
@ -209,9 +205,7 @@ class TestConfigList:
|
|||
@pytest.mark.parametrize("rc_file_args", ({"channels": ["channel1", "channel2"]},))
|
||||
def test_list_with_long_descriptions(self, rc_file, desc_flag):
|
||||
assert (
|
||||
config("list", "--no-env", "--rc-file", rc_file, desc_flag).splitlines()[
|
||||
:-4
|
||||
]
|
||||
config("list", "--no-env", "--rc-file", rc_file, desc_flag).splitlines()
|
||||
== "# channels\n# The list of channels where the packages will be searched for.\n"
|
||||
"# See also 'channel_priority'.\nchannels:\n - channel1\n - channel2\n".splitlines()
|
||||
)
|
||||
|
@ -228,7 +222,7 @@ class TestConfigList:
|
|||
assert (
|
||||
config(
|
||||
"list", "--no-env", "--rc-file", rc_file, "-d", group_flag
|
||||
).splitlines()[:-8]
|
||||
).splitlines()
|
||||
== f"{group}# channels\n# Define the list of channels\nchannels:\n"
|
||||
" - channel1\n - channel2\n".splitlines()
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue