# HG changeset patch # User Paul Boddie # Date 1530812044 -7200 # Node ID 3b243cd23b58d6251a35e5ab633b57eb9d1c0842 # Parent 2b30e05ae0d5ecc02632d3478faad61f1ad66cd5 Improved the tools, employing the program directory to find appropriate files. Fixed access location output when showing attribute plan details. diff -r 2b30e05ae0d5 -r 3b243cd23b58 encoders.py --- a/encoders.py Thu Jul 05 16:01:33 2018 +0200 +++ b/encoders.py Thu Jul 05 19:34:04 2018 +0200 @@ -78,6 +78,13 @@ return "%s:%s:%s:%d" % (t.path, t.name or "{}", t.attrnames or "{}", t.access_number) +def decode_access_location(s): + + "Decode the access location 's'." + + path, name, attrnames, access_number = s.split(":") + return path, name, attrnames, access_number + def encode_alias_location(t, invocation=False): "Encode the alias location 't'." diff -r 2b30e05ae0d5 -r 3b243cd23b58 tools/showalias.py --- a/tools/showalias.py Thu Jul 05 16:01:33 2018 +0200 +++ b/tools/showalias.py Thu Jul 05 19:34:04 2018 +0200 @@ -1,6 +1,6 @@ #!/usr/bin/env python -from os.path import abspath, split +from os.path import abspath, exists, join, split import sys # Find the modules. @@ -15,12 +15,18 @@ from encoders import decode_alias_location if len(sys.argv) < 3: - print >>sys.stderr, "Usage: %s " % sys.argv[0] + print >>sys.stderr, "Usage: %s " % sys.argv[0] sys.exit(1) -filename = sys.argv[1] +dirname = sys.argv[1] alias = sys.argv[2] +filename = join(dirname, "_deduced", "aliases") + +if not exists(filename): + print >>sys.stderr, "Directory %s does not provide file %s." % (dirname, filename) + sys.exit(1) + f = open(filename) try: for line in f.xreadlines(): diff -r 2b30e05ae0d5 -r 3b243cd23b58 tools/showplan.py --- a/tools/showplan.py Thu Jul 05 16:01:33 2018 +0200 +++ b/tools/showplan.py Thu Jul 05 19:34:04 2018 +0200 @@ -1,14 +1,32 @@ #!/usr/bin/env python +from os.path import abspath, exists, join, split import sys +# Find the modules. + +try: + import encoders +except ImportError: + parent = abspath(split(split(__file__)[0])[0]) + if split(parent)[1] == "Lichen": + sys.path.append(parent) + +from encoders import decode_access_location + if len(sys.argv) < 3: - print >>sys.stderr, "Usage: %s " % sys.argv[0] + print >>sys.stderr, "Usage: %s " % sys.argv[0] sys.exit(1) -filename = sys.argv[1] +dirname = sys.argv[1] access = sys.argv[2] +filename = join(dirname, "_deduced", "attribute_plans") + +if not exists(filename): + print >>sys.stderr, "Directory %s does not provide file %s." % (dirname, filename) + sys.exit(1) + f = open(filename) try: for line in f.xreadlines(): @@ -17,17 +35,21 @@ continue location, name, test, test_type, base, traversed, traversal_modes, \ - attrnames, context, context_test, first_method, final_method, attr, \ - accessor_kinds = columns + traversal_attrnames, context, context_test, \ + first_method, final_method, attr, accessor_kinds = columns + + path, _name, attrnames, access_number = decode_access_location(location) print "Location:", location print "Name:", name + print "Attribute names:", attrnames + print "Access number:", access_number print "Test:", test print "Test type:", test_type print "Base:", base print "Traversed:", traversed print "Traversal modes:", traversal_modes - print "Attribute names:", attrnames + print "Traversed attributes:", traversal_attrnames print "Context:", context print "Context test:", context_test print "First method:", first_method