diff options
author | Thomas Nagy <tnagy2pow10@gmail.com> | 2015-03-04 14:31:54 +0100 |
---|---|---|
committer | Amar Takhar <amar@rtems.org> | 2015-12-11 15:15:56 -0500 |
commit | b8dba76a154ed49d386b67186962c9bd347ea0d7 (patch) | |
tree | e16a5b420f47d8528154989a8be14277ca7054ef | |
parent | 79ea7c8324b4d34816410b3547880677b6383592 (diff) |
Removed ctx.cpu and ctx.counter class attributes since they should be context instance attributes
-rw-r--r-- | rtems_waf/builder.py | 13 | ||||
-rw-r--r-- | wscript | 4 |
2 files changed, 10 insertions, 7 deletions
diff --git a/rtems_waf/builder.py b/rtems_waf/builder.py index 0b9b68ed19..e1e944bf5c 100644 --- a/rtems_waf/builder.py +++ b/rtems_waf/builder.py @@ -16,12 +16,17 @@ class rtems_base(object): def _get_id(self, name): name_id = "auto_%s" % name - if name_id not in self.ctx.counter: - self.ctx.counter[name_id] = 0 + try: + counter = self.ctx.counter + except AttributeError: + counter = self.ctx.counter = {} + + if name_id not in counter: + counter[name_id] = 0 return "%s_0" % name_id else: - self.ctx.counter[name_id] += 1 - return "%s_%d" % (name_id, self.ctx.counter[name_id]) + counter[name_id] += 1 + return "%s_%d" % (name_id, counter[name_id]) def _obj_add(self, name, source, **kwarg): @@ -73,7 +73,7 @@ def init_handler(ctx): # By default we want to itterate over each variant. for v in ["host"] + config["variants"]: - cls = type(context)(v, (context,), {'cmd': ctx.cmd, 'variant': v, 'counter': {}, 'cpu': None}) + cls = type(context)(v, (context,), {'cmd': ctx.cmd, 'variant': v}) bld = cls() if hasattr(ctx, 'targets'): bld.targets = ctx.targets @@ -102,8 +102,6 @@ for variant in ["host"] + config["variants"]: __doc__ = "%s %s BSP" % (cmd, v) cmd = "%s_%s" % (cmd, v) variant = variant - counter = {} - cpu = None # These will stay local functions to avoid importing the subcommands # upon every invocation which will happen during regular development. |