Skip to content

Commit

Permalink
Modify specification interface with better name.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed Jan 18, 2017
1 parent 6de74a7 commit 4a544e9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions lib/galaxy/tools/deps/resolvers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ class SpecificationAwareDependencyResolver:
__metaclass__ = ABCMeta

@abstractmethod
def find_specification(self, specs):
"""Find closest matching specification for discovered resolver."""
def _expand_specs(self, requirement):
"""Find closest matching specification for discovered resolver and return new concrete requirement."""


class SpecificationPatternDependencyResolver:
Expand All @@ -85,19 +85,19 @@ class SpecificationPatternDependencyResolver:
def _specification_pattern(self):
"""Pattern of URI to match against."""

def find_specification(self, specs):
def _find_specification(self, specs):
pattern = self._specification_pattern
for spec in specs:
if pattern.match(spec.uri):
return spec
return None

def resolve_specs(self, requirement):
def _expand_specs(self, requirement):
name = requirement.name
version = requirement.version
specs = requirement.specs

spec = self.find_specification(specs)
spec = self._find_specification(specs)
if spec is not None:
name = spec.short_name
version = spec.version or version
Expand Down
4 changes: 2 additions & 2 deletions lib/galaxy/tools/deps/resolvers/conda.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def resolve_all(self, requirements, **kwds):

conda_targets = []
for requirement in requirements:
requirement = self.resolve_specs(requirement)
requirement = self._expand_specs(requirement)

version = requirement.version
if self.versionless:
Expand Down Expand Up @@ -186,7 +186,7 @@ def merged_environment_name(self, conda_targets):
return conda_targets[0].install_environment

def resolve(self, requirement, **kwds):
requirement = self.resolve_specs(requirement)
requirement = self._expand_specs(requirement)
name, version, type = requirement.name, requirement.version, requirement.type

# Check for conda just not being there, this way we can enable
Expand Down

0 comments on commit 4a544e9

Please sign in to comment.