diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2013-02-25 18:18:48 -0800 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2013-02-25 18:18:48 -0800 |
commit | e410df743a63d2a22de94679cef98286c0c4565b (patch) | |
tree | 981edafb02ae667565deefba7e99ba8eeccc86d3 /lib | |
parent | 27b92047854d47465b7efeef8f1bc6f8922ba91c (diff) | |
download | spack-e410df743a63d2a22de94679cef98286c0c4565b.tar.gz spack-e410df743a63d2a22de94679cef98286c0c4565b.tar.bz2 spack-e410df743a63d2a22de94679cef98286c0c4565b.tar.xz spack-e410df743a63d2a22de94679cef98286c0c4565b.zip |
Simpler implementation of depends_on.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/Package.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/spack/spack/Package.py b/lib/spack/spack/Package.py index 5ed842c2ee..f8256b9add 100644 --- a/lib/spack/spack/Package.py +++ b/lib/spack/spack/Package.py @@ -1,3 +1,4 @@ +import sys import inspect import os import re @@ -39,13 +40,11 @@ def depends_on(*args, **kwargs): """Adds a depends_on local variable in the locals of the calling class, based on args. """ - stack = inspect.stack() - try: - locals = stack[1][0].f_locals - finally: - del stack + # This gets the calling frame so we can pop variables into it + locals = sys._getframe(1).f_locals - dependencies = locals.setdefault("dependencies", []) + # Put deps into the dependencies variable + dependencies = locals.setdefault("dependencies", []) for name in args: dependencies.append(Dependency(name)) |