Skip to content

Commit

Permalink
-made 'context' optional in Solver, fixes some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ajohns committed Feb 28, 2017
1 parent e5644c8 commit 70ed6d1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/rez/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,9 @@ def _memcache_key(self, timestamped=False):
return str(tuple(t))

def _solve(self):
solver = Solver(context=self.context,
package_requests=self.package_requests,
solver = Solver(package_requests=self.package_requests,
package_paths=self.package_paths,
context=self.context,
package_filter=self.package_filter,
package_orderers=self.package_orderers,
callback=self.callback,
Expand Down
13 changes: 8 additions & 5 deletions src/rez/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -1754,16 +1754,19 @@ class Solver(_Common):
"""
max_verbosity = 3

def __init__(self, context, package_requests, package_paths, package_filter=None,
package_orderers=None, callback=None, building=False,
optimised=True, verbosity=0, buf=None, package_load_callback=None,
prune_unfailed=True):
def __init__(self, package_requests, package_paths, context=None,
package_filter=None, package_orderers=None, callback=None,
building=False, optimised=True, verbosity=0, buf=None,
package_load_callback=None, prune_unfailed=True):
"""Create a Solver.
Args:
package_requests: List of Requirement objects representing the
request.
package_paths: List of paths to search for pkgs.
context (`ResolvedContext`): Context this solver is used within, if
any. This is needed in a solve if any packages contain late
binding package attributes that need access to context info.
package_filter (`PackageFilterBase`): Filter for excluding packages.
package_orderers (list of `PackageOrder`): Custom package ordering.
building: True if we're resolving for a build.
Expand All @@ -1784,7 +1787,6 @@ def __init__(self, context, package_requests, package_paths, package_filter=None
True, any packages unrelated to the conflict are removed from
the graph.
"""
self.context = context
self.package_paths = package_paths
self.package_filter = package_filter
self.package_orderers = package_orderers
Expand All @@ -1795,6 +1797,7 @@ def __init__(self, context, package_requests, package_paths, package_filter=None
self.package_load_callback = package_load_callback
self.building = building
self.request_list = None
self.context = context

self.non_conflict_package_requests = [x for x in package_requests
if not x.conflict]
Expand Down

0 comments on commit 70ed6d1

Please sign in to comment.