Commit 60e419e6 authored by Robert Bradshaw's avatar Robert Bradshaw

Fix a couple of tests due to utility code changes.

parent 96eea730
...@@ -553,6 +553,7 @@ class LazyUtilityCode(UtilityCodeBase): ...@@ -553,6 +553,7 @@ class LazyUtilityCode(UtilityCodeBase):
Utility code that calls a callback with the root code writer when Utility code that calls a callback with the root code writer when
available. Useful when you only have 'env' but not 'code'. available. Useful when you only have 'env' but not 'code'.
""" """
__name__ = '<lazy>'
def __init__(self, callback): def __init__(self, callback):
self.callback = callback self.callback = callback
......
...@@ -87,8 +87,10 @@ def sort_utility_codes(utilcodes): ...@@ -87,8 +87,10 @@ def sort_utility_codes(utilcodes):
ranks[utilcode] = 0 ranks[utilcode] = 0
ranks[utilcode] = 1 + min([get_rank(dep) for dep in utilcode.requires or ()] or [-1]) ranks[utilcode] = 1 + min([get_rank(dep) for dep in utilcode.requires or ()] or [-1])
return ranks[utilcode] return ranks[utilcode]
for utilcode in utilcodes: for ix, utilcode in enumerate(utilcodes):
get_rank(utilcode) get_rank(utilcode)
# Bias towards original order.
ranks[utilcode] -= ix * 1e-10
return [utilcode for utilcode, _ in sorted(ranks.items(), key=lambda kv: kv[1])] return [utilcode for utilcode, _ in sorted(ranks.items(), key=lambda kv: kv[1])]
def normalize_deps(utilcodes): def normalize_deps(utilcodes):
......
...@@ -147,7 +147,9 @@ class CythonUtilityCode(Code.UtilityCodeBase): ...@@ -147,7 +147,9 @@ class CythonUtilityCode(Code.UtilityCodeBase):
before=transform) before=transform)
for dep in self.requires: for dep in self.requires:
if isinstance(dep, CythonUtilityCode): if (isinstance(dep, CythonUtilityCode)
and hasattr(dep, 'tree')
and not cython_scope):
def scope_transform(module_node): def scope_transform(module_node):
module_node.scope.merge_in(dep.tree.scope) module_node.scope.merge_in(dep.tree.scope)
return module_node return module_node
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment