summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkennyballou <kballou@onyx.boisestate.edu>2013-09-28 13:17:16 -0600
committerkennyballou <kballou@onyx.boisestate.edu>2013-10-03 16:29:28 -0600
commit2ff29b2be1397683d3331581992fa77d50af7925 (patch)
treebb93b7046eb1cc3f06196f62127652395faefed0
parent1e493ef9fb90a5b3cb238fdc5d765157b3c9e949 (diff)
downloadxnt-2ff29b2be1397683d3331581992fa77d50af7925.tar.gz
xnt-2ff29b2be1397683d3331581992fa77d50af7925.tar.xz
Add target run check
* Add `has_run` check to targets to ensure targets only execute once per build
-rw-r--r--xnt/__init__.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/xnt/__init__.py b/xnt/__init__.py
index 61de895..767c2b7 100644
--- a/xnt/__init__.py
+++ b/xnt/__init__.py
@@ -60,10 +60,13 @@ def target(target_fn):
build file as a "target" method, or a method meant
to be invoked from Xnt
"""
+ has_run = [False,]
def wrap():
"""Inner wrapper function for decorator"""
- print(target_fn.__name__ + ":")
- return target_fn()
+ if not has_run[0]:
+ has_run[0] = True
+ print(target_fn.__name__ + ":")
+ return target_fn()
wrap.decorator = "target"
wrap.__doc__ = target_fn.__doc__
return wrap