From 2ff29b2be1397683d3331581992fa77d50af7925 Mon Sep 17 00:00:00 2001 From: kennyballou Date: Sat, 28 Sep 2013 13:17:16 -0600 Subject: Add target run check * Add `has_run` check to targets to ensure targets only execute once per build --- xnt/__init__.py | 7 +++++-- 1 file 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 -- cgit v1.2.1