Skip to content

Commit

Permalink
Delay conda init until a dependency install is attempted
Browse files Browse the repository at this point in the history
  • Loading branch information
natefoo committed Oct 23, 2024
1 parent fd59c28 commit c28f3a0
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions lib/galaxy/tool_util/deps/resolvers/conda.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,7 @@ def get_option(name):
auto_install = _string_as_bool(get_option("auto_install"))
self.auto_init = _string_as_bool(get_option("auto_init"))
self.conda_context = conda_context
self.disabled = not galaxy.tool_util.deps.installable.ensure_installed(
conda_context, install_conda, self.auto_init
)
if self.auto_init and not self.disabled:
self.conda_context.ensure_conda_build_installed_if_needed()
self.disabled = False
self.auto_install = auto_install
self.copy_dependencies = copy_dependencies

Expand Down Expand Up @@ -189,6 +185,12 @@ def install_all(self, conda_targets: List[CondaTarget], env: str) -> bool:
if self.read_only:
return False

self.disabled = not galaxy.tool_util.deps.installable.ensure_installed(
self.conda_context, install_conda, self.auto_init
)
if self.auto_init and not self.disabled:
self.conda_context.ensure_conda_build_installed_if_needed()

return_code = install_conda_targets(conda_targets, conda_context=self.conda_context, env_name=env)
if return_code != 0:
is_installed = False
Expand Down Expand Up @@ -221,9 +223,6 @@ def resolve_all(self, requirements: ToolRequirements, **kwds) -> List[Dependency
if len(requirements) == 0:
return []

if not os.path.isdir(self.conda_context.conda_prefix):
return []

for requirement in requirements:
if requirement.type != "package":
return []
Expand Down Expand Up @@ -252,6 +251,9 @@ def resolve_all(self, requirements: ToolRequirements, **kwds) -> List[Dependency
if install:
is_installed = self.install_all(conda_targets, env)

if not os.path.isdir(self.conda_context.conda_prefix):
return []

dependencies: List[Dependency] = []
if is_installed:
for requirement in requirements:
Expand Down

0 comments on commit c28f3a0

Please sign in to comment.