Skip to content
This repository has been archived by the owner on Jul 24, 2020. It is now read-only.

Commit

Permalink
Merge pull request #109 from galaxyproject/catch_errors
Browse files Browse the repository at this point in the history
catch error during conda search
  • Loading branch information
jmchilton committed May 6, 2018
2 parents f3b1abc + de40459 commit dad6afe
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions galaxy/tools/deps/conda_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import six
from six.moves import shlex_quote

from galaxy.tools.deps.commands import CommandLineException
from galaxy.util import unicodify
from . import (
commands,
Expand Down Expand Up @@ -503,10 +504,14 @@ def best_search_result(conda_target, conda_context, channels_override=None, offl
else:
search_cmd.extend(conda_context._override_channels_args)
search_cmd.append(conda_target.package)
res = commands.execute(search_cmd)
res = unicodify(res)
hits = json.loads(res).get(conda_target.package, [])
hits = sorted(hits, key=lambda hit: packaging.version.parse(hit['version']), reverse=True)
try:
res = commands.execute(search_cmd)
res = unicodify(res)
hits = json.loads(res).get(conda_target.package, [])
hits = sorted(hits, key=lambda hit: packaging.version.parse(hit['version']), reverse=True)
except CommandLineException:
log.error("Could not execute: '%s'", search_cmd)
hits = []

if len(hits) == 0:
return (None, None)
Expand Down

0 comments on commit dad6afe

Please sign in to comment.