comparison env/lib/python3.9/site-packages/planemo/commands/cmd_conda_init.py @ 0:4f3585e2f14b draft default tip

"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author shellac
date Mon, 22 Mar 2021 18:12:50 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4f3585e2f14b
1 """Module describing the planemo ``conda_init`` command."""
2 import click
3 from galaxy.tool_util.deps import conda_util
4
5 from planemo import options
6 from planemo.cli import command_function
7 from planemo.conda import build_conda_context
8 from planemo.exit_codes import EXIT_CODE_ALREADY_EXISTS
9 from planemo.io import info, warn
10
11
12 MESSAGE_ERROR_ALREADY_EXISTS = "conda_init failed - Conda appears to already be installed at '%s'"
13 MESSAGE_ERROR_FAILED = "conda_init failed - failed to install to '%s'"
14 MESSAGE_INSTALL_OKAY = "Conda installation succeeded - Conda is available at '%s'"
15
16
17 @click.command('conda_init')
18 @options.conda_target_options(include_local=False) # Always use local during init.
19 @command_function
20 def cli(ctx, **kwds):
21 """Download and install conda.
22
23 This will download conda for managing dependencies for your platform
24 using the appropriate Miniconda installer.
25
26 By running this command, you are agreeing to the terms of the conda
27 license a 3-clause BSD 3 license. Please review full license at
28 http://docs.continuum.io/anaconda/eula.
29
30 Planemo will print a warning and terminate with an exit code of 7
31 if Conda is already installed.
32 """
33 conda_context = build_conda_context(ctx, **kwds)
34 if conda_context.is_conda_installed():
35 warn(MESSAGE_ERROR_ALREADY_EXISTS % conda_context.conda_exec)
36 exit = EXIT_CODE_ALREADY_EXISTS
37 else:
38 exit = conda_util.install_conda(conda_context=conda_context, force_conda_build=True)
39 if exit:
40 warn(MESSAGE_ERROR_FAILED % conda_context.conda_exec)
41 else:
42 info(MESSAGE_INSTALL_OKAY % conda_context.conda_exec)
43
44 ctx.exit(exit)