summaryrefslogtreecommitdiff
path: root/indra/lib
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2018-06-30 10:01:11 -0400
committerNat Goodspeed <nat@lindenlab.com>2018-06-30 10:01:11 -0400
commitbbadee86c104609cc47be20297470bd7abab8008 (patch)
tree256591dea8adb1212825b840bfa930bd70f82fa2 /indra/lib
parent93ea0d7026dcb7a9aec3bd4f8615eb62da159a02 (diff)
MAINT-8822: Give LLManifest.prefix() (suppressed) debugging output.
Diffstat (limited to 'indra/lib')
-rwxr-xr-xindra/lib/python/indra/util/llmanifest.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/indra/lib/python/indra/util/llmanifest.py b/indra/lib/python/indra/util/llmanifest.py
index 4c3d3fc217..974ac18e34 100755
--- a/indra/lib/python/indra/util/llmanifest.py
+++ b/indra/lib/python/indra/util/llmanifest.py
@@ -421,25 +421,34 @@ class LLManifest(object):
self.build_prefix.append(build)
self.dst_prefix.append(dst)
+## self.display_stacks()
+
# The above code is unchanged from the original implementation. What's
# new is the return value. We're going to return an instance of
# PrefixManager that binds this LLManifest instance and Does The Right
# Thing on exit.
return self.PrefixManager(self)
+ def display_stacks(self):
+ width = 1 + max(len(stack) for stack in self.PrefixManager.stacks)
+ for stack in self.PrefixManager.stacks:
+ print "{} {}".format((stack + ':').ljust(width),
+ os.path.join(*getattr(self, stack)))
+
class PrefixManager(object):
+ # stack attributes we manage in this LLManifest (sub)class
+ # instance
+ stacks = ("src_prefix", "artwork_prefix", "build_prefix", "dst_prefix")
+
def __init__(self, manifest):
self.manifest = manifest
- # stack attributes we manage in this LLManifest (sub)class
- # instance
- stacks = ("src_prefix", "artwork_prefix", "build_prefix", "dst_prefix")
# If the caller wrote:
# with self.prefix(...):
# as intended, then bind the state of each prefix stack as it was
# just BEFORE the call to prefix(). Since prefix() appended an
# entry to each prefix stack, capture len()-1.
self.prevlen = { stack: len(getattr(self.manifest, stack)) - 1
- for stack in stacks }
+ for stack in self.stacks }
def __nonzero__(self):
# If the caller wrote:
@@ -472,6 +481,8 @@ class LLManifest(object):
# truncate that list back to 'prevlen'
del getattr(self.manifest, stack)[prevlen:]
+## self.manifest.display_stacks()
+
def end_prefix(self, descr=None):
"""Pops a prefix off the stack. If given an argument, checks
the argument against the top of the stack. If the argument