Skip to content

Commit

Permalink
feat(miniconda): --run to run arbirary commands to possibly tune up t…
Browse files Browse the repository at this point in the history
…hat miniconda installation
  • Loading branch information
yarikoptic committed Oct 31, 2024
1 parent d9e289a commit 69f4fcc
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/datalad_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,13 @@ class MinicondaComponent(Component):
help="Install Miniconda at the given path",
),
Option("--batch", is_flag=True, help="Run in batch (noninteractive) mode"),
Option(
"--run",
multiple=True,
help="Additional commands to run on an installed conda instance."
" If starts with 'conda', uses conda from installed miniconda."
" E.g. 'conda config --remove channels defaults' to remove the defaults channel",
),
Option(
"-c",
"--channel",
Expand Down Expand Up @@ -980,6 +987,7 @@ def provide(
self,
path: Optional[Path] = None,
batch: bool = False,
run: Optional[list[str]] = None,
spec: Optional[list[str]] = None,
python_match: Optional[str] = None,
extra_args: Optional[list[str]] = None,
Expand Down Expand Up @@ -1074,6 +1082,12 @@ def provide(
"defaults",
"conda",
)
for cmd in run or []:
cmd_split = shlex.split(cmd)
if cmd_split[0] == "conda":
runcmd(conda_instance.conda_exe, *cmd_split[1:])
else:
runcmd(*cmd_split)
if spec is not None:
install_args: list[str] = []
if batch:
Expand Down

0 comments on commit 69f4fcc

Please sign in to comment.