def main(*args, **kwargs): # Set to false so we don't allow uploading our issues to conda! context.report_errors = False from conda.common.compat import ensure_text_type, init_std_stream_encoding init_std_stream_encoding() print(banner) if 'activate' in sys.argv or 'deactivate' in sys.argv: print("Use conda to activate / deactivate the environment.") print('\n $ conda ' + ' '.join(sys.argv[1:]) + '\n') return sys.exit(-1) if not args: args = sys.argv args = tuple(ensure_text_type(s) for s in args) if args[1] == 'env' and args[2] == 'create': # special handling for conda env create! from mamba import mamba_env return mamba_env.main() from conda.exceptions import conda_exception_handler return conda_exception_handler(_wrapped_main, *args, **kwargs)
def main(*args, **kwargs): # Set to false so we don't allow uploading our issues to conda! context.report_errors = False from conda.common.compat import ensure_text_type, init_std_stream_encoding init_std_stream_encoding() if "activate" in sys.argv or "deactivate" in sys.argv: print( f"Run 'mamba init' to be able to run mamba activate/deactivate\n" f"and start a new shell session. Or use conda to activate/deactivate.\n" f"\n" f" $ conda {' '.join(sys.argv[1:])}\n", file=sys.stderr, ) return sys.exit(-1) if not args: args = sys.argv if "--version" in args: from mamba._version import __version__ print("mamba {}".format(__version__)) args = tuple(ensure_text_type(s) for s in args) if len(args) > 2 and args[1] == "env" and args[2] in ("create", "update"): # special handling for conda env create! from mamba import mamba_env return mamba_env.main() def exception_converter(*args, **kwargs): exit_code = 0 try: exit_code = _wrapped_main(*args, **kwargs) except api.MambaNativeException as e: print(e) except MambaException as e: print(e) except Exception as e: raise e return exit_code from conda.exceptions import conda_exception_handler return conda_exception_handler(exception_converter, *args, **kwargs)
def main(*args, **kwargs): # Set to false so we don't allow uploading our issues to conda! context.report_errors = False from conda.common.compat import ensure_text_type, init_std_stream_encoding init_std_stream_encoding() if 'activate' in sys.argv or 'deactivate' in sys.argv: print("Use conda to activate / deactivate the environment.") print('\n $ conda ' + ' '.join(sys.argv[1:]) + '\n') return sys.exit(-1) if not args: args = sys.argv if "--version" in args: from mamba._version import __version__ print("mamba {}".format(__version__)) args = tuple(ensure_text_type(s) for s in args) if len(args) > 2 and args[1] == 'env' and args[2] in ('create', 'update'): # special handling for conda env create! from mamba import mamba_env return mamba_env.main() def exception_converter(*args, **kwargs): exit_code = 0 try: exit_code = _wrapped_main(*args, **kwargs) except api.MambaNativeException as e: print(e) except MambaException as e: print(e) except Exception as e: raise e return exit_code from conda.exceptions import conda_exception_handler return conda_exception_handler(exception_converter, *args, **kwargs)