Simpler implementation of depends_on.
This commit is contained in:
parent
27b9204785
commit
e410df743a
1 changed files with 5 additions and 6 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
import sys
|
||||||
import inspect
|
import inspect
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
@ -39,13 +40,11 @@ def depends_on(*args, **kwargs):
|
||||||
"""Adds a depends_on local variable in the locals of
|
"""Adds a depends_on local variable in the locals of
|
||||||
the calling class, based on args.
|
the calling class, based on args.
|
||||||
"""
|
"""
|
||||||
stack = inspect.stack()
|
# This gets the calling frame so we can pop variables into it
|
||||||
try:
|
locals = sys._getframe(1).f_locals
|
||||||
locals = stack[1][0].f_locals
|
|
||||||
finally:
|
|
||||||
del stack
|
|
||||||
|
|
||||||
dependencies = locals.setdefault("dependencies", [])
|
# Put deps into the dependencies variable
|
||||||
|
dependencies = locals.setdefault("dependencies", [])
|
||||||
for name in args:
|
for name in args:
|
||||||
dependencies.append(Dependency(name))
|
dependencies.append(Dependency(name))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue