File tree Expand file tree Collapse file tree 3 files changed +65
-0
lines changed
planemo_ext/galaxy/tools/deps Expand file tree Collapse file tree 3 files changed +65
-0
lines changed Original file line number Diff line number Diff line change 1+ import click
2+
3+ from planemo .cli import pass_context
4+ from planemo .io import shell
5+ from planmo import options
6+ from galaxy .tools .deps import conda_util
7+
8+
9+ @click .command ('conda_init' )
10+ @options .conda_prefix_option ()
11+ @pass_context
12+ def cli (ctx , conda_prefix = None ):
13+ """Download and install conda.
14+
15+ This will download conda for managing dependencies for your platform
16+ using the appropriate Miniconda installer.
17+
18+ By running this command, you are agreeing to the terms of the conda
19+ license a 3-clause BSD 3 license. Please review full license at
20+ http://docs.continuum.io/anaconda/eula.
21+ """
22+ conda_util (conda_prefix , shell_exec = shell )
Original file line number Diff line number Diff line change @@ -188,6 +188,14 @@ def brew_option():
188188 )
189189
190190
191+ def conda_prefix_option ():
192+ return click .option (
193+ "--conda_prefix" ,
194+ type = click .Path (file_okay = False , dir_okay = True ),
195+ help = "Conda prefix to use for conda dependency commands."
196+ )
197+
198+
191199def required_tool_arg ():
192200 """ Decorate click method as requiring the path to a single tool.
193201 """
Original file line number Diff line number Diff line change 1+ from ..deps import commands
2+ from sys import platform as _platform
3+ import os .path
4+
5+ IS_OS_X = _platform == "darwin"
6+
7+ # BSD 3-clause
8+ CONDA_LICENSE = "http://docs.continuum.io/anaconda/eula"
9+
10+
11+ def conda_link ():
12+ if IS_OS_X :
13+ url = "https://repo.continuum.io/miniconda/Miniconda-latest-MacOSX-x86_64.sh"
14+ else :
15+ url = "https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh"
16+ return url
17+
18+
19+ def find_conda_prefix (conda_prefix = None ):
20+ """ If supplied conda_prefix is not set, default to the default location
21+ for Miniconda installs.
22+ """
23+ if conda_prefix is None :
24+ return os .path .join (os .path .expanduser ("~" ), "miniconda2" )
25+ return conda_prefix
26+
27+
28+ def install_conda_command (prefix , shell_exec = None ):
29+ if shell_exec is None :
30+ shell_exec = commands .shell
31+ download_cmd = " " .join (commands .download_command (conda_link (), quote = True ))
32+ download_cmd = "%s > /tmp/conda.bash"
33+ install_cmd = "bash /tmp/conda.bash -b -p '%s'" % prefix
34+ full_command = "%s; %s" % (download_cmd , install_cmd )
35+ return shell_exec (full_command )
You can’t perform that action at this time.
0 commit comments