Browse Source

refactoring for info, export and debug tools

avkonst 12 years ago
parent
commit
2b6e9dd3a0

+ 1 - 1
mainline/ext/std/tools/collect.py

@@ -33,7 +33,7 @@ class Plugin(mpp.api.Plugin, mpp.api.Parent, mpp.api.IConfigurable, mpp.api.IRun
         self.exclude_rules = []
         self.exclude_files = []
         self.parsers       = []
-        
+        super(Plugin, self).__init__()
 
     def declare_configuration(self, parser):
         parser.add_option("--std.general.proctime", "--sgpt", action="store_true", default=False,

+ 27 - 0
mainline/ext/std/tools/debug.ini

@@ -0,0 +1,27 @@
+;
+;    Metrix++, Copyright 2009-2013, Metrix++ Project
+;    Link: http://metrixplusplus.sourceforge.net
+;    
+;    This file is a part of Metrix++ Tool.
+;    
+;    Metrix++ is free software: you can redistribute it and/or modify
+;    it under the terms of the GNU General Public License as published by
+;    the Free Software Foundation, version 3 of the License.
+;    
+;    Metrix++ is distributed in the hope that it will be useful,
+;    but WITHOUT ANY WARRANTY; without even the implied warranty of
+;    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;    GNU General Public License for more details.
+;    
+;    You should have received a copy of the GNU General Public License
+;    along with Metrix++.  If not, see <http://www.gnu.org/licenses/>.
+;
+
+[Plugin]
+version: 1.0
+package: std.tools
+module:  debug
+class:   Plugin
+depends: mpp.dbf
+actions: debug
+enabled: True

+ 118 - 0
mainline/ext/std/tools/debug.py

@@ -0,0 +1,118 @@
+#
+#    Metrix++, Copyright 2009-2013, Metrix++ Project
+#    Link: http://metrixplusplus.sourceforge.net
+#    
+#    This file is a part of Metrix++ Tool.
+#    
+#    Metrix++ is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, version 3 of the License.
+#    
+#    Metrix++ is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#    GNU General Public License for more details.
+#    
+#    You should have received a copy of the GNU General Public License
+#    along with Metrix++.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+
+import logging
+import cgi
+
+import mpp.api
+
+class Plugin(mpp.api.Plugin, mpp.api.IConfigurable, mpp.api.IRunable):
+    
+    def declare_configuration(self, parser):
+        parser.add_option("-m", "--mode", default='dumphtml', choices=['dumphtml'],
+                             help="'dumphtml' - prints html code with code highlights for each given path [default: %default]")
+    
+    def configure(self, options):
+        self.mode = options.__dict__['mode']
+
+    def run(self, args):
+        loader = self.get_plugin_loader().get_plugin('mpp.dbf').get_loader()
+    
+        if self.mode == 'dumphtml':
+            return dumphtml(args, loader)
+        assert(False)
+
+def dumphtml(args, loader):
+    exit_code = 0
+    result = ""
+    result += '<html><body>'
+    for path in args:
+        path = mpp.utils.preprocess_path(path)
+        
+        data = loader.load_file_data(path)
+        if data == None:
+            mpp.utils.report_bad_path(path)
+            exit_code += 1
+            continue
+        
+        file_name = data.get_path()
+        fh = open(file_name, 'r')
+        if fh == None:
+            logging.error("can not open file '" + path + "' for reading")
+            exit_code += 1
+            continue
+        text = fh.read()
+        fh.close()
+        
+        result += '<table><tr><td><pre>'
+        last_pos = 0
+        for marker in data.iterate_markers():
+            result += (cgi.escape(text[last_pos:marker.begin]))
+            if marker.get_type() == data.get_marker_types().STRING:
+                result += ('<span style="color:#0000FF">')
+            elif marker.get_type() == data.get_marker_types().COMMENT:
+                result += ('<span style="color:#009900">')
+            elif marker.get_type() == data.get_marker_types().PREPROCESSOR:
+                result += ('<span style="color:#990000">')
+            else:
+                # TODO add tests for debug tool
+                assert False, "Uknown marker type"
+            result += (cgi.escape(text[marker.begin:marker.end]))
+            result += ('</span>')
+            last_pos = marker.end
+        result += (cgi.escape(text[last_pos:]))
+        last_pos = 0
+        result += ('</pre></td><td><pre>')
+        styles = [('<span style="background-color:#F0F010">',
+                  '<span style="background-color:#F010F0">'),
+                  ('<span style="background-color:#F0F030">',
+                  '<span style="background-color:#F030F0">'),
+                  ('<span style="background-color:#F0F050">',
+                  '<span style="background-color:#F050F0">'),
+                  ('<span style="background-color:#F0F070">',
+                  '<span style="background-color:#F070F0">'),
+                  ('<span style="background-color:#F0F090">',
+                  '<span style="background-color:#F090F0">'),
+                  ('<span style="background-color:#F0F0B0">',
+                  '<span style="background-color:#F0B0F0">'),
+                  ('<span style="background-color:#F0F0D0">',
+                  '<span style="background-color:#F0D0F0">'),
+                  ('<span style="background-color:#F0F0E0">',
+                  '<span style="background-color:#F0E0F0">')]
+        
+        def proc_rec(region_id, file_data, styles, indent, pos):
+            result = (styles[indent % len(styles)][pos % 2])
+            region = file_data.get_region(region_id)
+            result += ('<a href="#line' + str(region.get_cursor()) + '" id=line"' + str(region.get_cursor()) + '"></a>')
+            last_pos = region.get_offset_begin() 
+            for (ind, sub_id) in enumerate(file_data.get_region(region_id).iterate_subregion_ids()):
+                subregion = file_data.get_region(sub_id)
+                result += (cgi.escape(text[last_pos:subregion.get_offset_begin()]))
+                result += proc_rec(sub_id, file_data, styles, indent + 3, ind)
+                last_pos = subregion.get_offset_end()
+            result += (cgi.escape(text[last_pos:region.get_offset_end()]))
+            result += ('</span>')
+            return result
+        result += proc_rec(1, data, styles, 0, 0)
+        result += ('</pre></td></tr></table>')
+    result += ('</body></html>')
+    print result
+    return exit_code
+            

+ 27 - 0
mainline/ext/std/tools/export.ini

@@ -0,0 +1,27 @@
+;
+;    Metrix++, Copyright 2009-2013, Metrix++ Project
+;    Link: http://metrixplusplus.sourceforge.net
+;    
+;    This file is a part of Metrix++ Tool.
+;    
+;    Metrix++ is free software: you can redistribute it and/or modify
+;    it under the terms of the GNU General Public License as published by
+;    the Free Software Foundation, version 3 of the License.
+;    
+;    Metrix++ is distributed in the hope that it will be useful,
+;    but WITHOUT ANY WARRANTY; without even the implied warranty of
+;    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;    GNU General Public License for more details.
+;    
+;    You should have received a copy of the GNU General Public License
+;    along with Metrix++.  If not, see <http://www.gnu.org/licenses/>.
+;
+
+[Plugin]
+version: 1.0
+package: std.tools
+module:  export
+class:   Plugin
+depends: mpp.dbf
+actions: export
+enabled: False

+ 125 - 0
mainline/ext/std/tools/export.py

@@ -0,0 +1,125 @@
+#
+#    Metrix++, Copyright 2009-2013, Metrix++ Project
+#    Link: http://metrixplusplus.sourceforge.net
+#    
+#    This file is a part of Metrix++ Tool.
+#    
+#    Metrix++ is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, version 3 of the License.
+#    
+#    Metrix++ is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#    GNU General Public License for more details.
+#    
+#    You should have received a copy of the GNU General Public License
+#    along with Metrix++.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+
+
+import logging
+import csv
+
+import mpp.api
+import mpp.log
+import mpp.dbf
+import mpp.cmdparser
+
+import mpp.utils
+
+class Tool(mpp.api.ITool):
+    def run(self, tool_args):
+        return main(tool_args)
+
+def main(tool_args):
+    
+    log_plugin = mpp.log.Plugin()
+    db_plugin = mpp.dbf.Plugin()
+
+    parser = mpp.cmdparser.MultiOptionParser(usage="Usage: %prog export [options] -- [path 1] ... [path N]")
+    log_plugin.declare_configuration(parser)
+    db_plugin.declare_configuration(parser)
+    parser.add_option("--format", "--ft", default='csv', choices=['csv', 'xml'], help="Format of the output data. "
+                      "Possible values are 'xml' and 'csv' [default: %default]")
+
+    (options, args) = parser.parse_args(tool_args)
+    log_plugin.configure(options)
+    db_plugin.configure(options)
+    out_format = options.__dict__['format']
+
+    log_plugin.initialize()
+    db_plugin.initialize()
+
+    loader_prev = db_plugin.get_loader_prev()
+    loader = db_plugin.get_loader()
+    
+    # Check for versions consistency
+    for each in loader.iterate_properties():
+        if db_plugin.dbfile_prev != None:
+            prev = loader_prev.get_property(each.name)
+            if prev != each.value:
+                logging.warn("Previous data has got different metadata:")
+                logging.warn(" - identification of change trends can be not reliable")
+                logging.warn(" - use 'info' tool to get more details")
+                break
+    
+    paths = None
+    if len(args) == 0:
+        paths = [""]
+    else:
+        paths = args
+        
+    exit_code = export_to_stdout(out_format, paths, loader, loader_prev)
+    return exit_code
+
+def export_to_stdout(out_format, paths, loader, loader_prev):
+    class StdoutWriter(object):
+        def write(self, *args, **kwargs):
+            print args[0],
+    
+    exit_code = 0
+
+
+    columnNames = ["file", "region", ]
+    columns = []
+    for name in loader.iterate_namespace_names():
+        namespace = loader.get_namespace(name)
+        for field in namespace.iterate_field_names():
+            columns.append((name, field, namespace.are_regions_supported()))
+            columnNames.append(name + ":" + field)
+
+    writer = StdoutWriter()
+    csvWriter = csv.writer(writer)
+    csvWriter.writerow(columnNames)
+    
+    if out_format == 'xml':
+        print "<export>\n"
+    elif out_format == 'csv':
+        print "CSV"
+    else:
+        assert False, "Unknown output format " + out_format
+
+    for path in paths:
+        path = mpp.utils.preprocess_path(path)
+        
+        files = loader.iterate_file_data(path)
+        if files != None:
+            for file_data in files:
+                for reg in file_data.iterate_regions():
+                    per_reg_data = []
+                    for column in columns:
+                        per_reg_data.append(reg.get_data(column[0], column[1]))
+                    csvWriter.writerow([file_data.get_path(), reg.get_name()] + per_reg_data)
+                per_file_data = []
+                for column in columns:
+                    per_file_data.append(file_data.get_data(column[0], column[1]))
+                csvWriter.writerow([file_data.get_path(), None] + per_file_data)
+        else:
+            mpp.utils.report_bad_path(path)
+            exit_code += 1
+
+    if out_format == 'xml':
+        print "XML"
+    return 0

+ 27 - 0
mainline/ext/std/tools/info.ini

@@ -0,0 +1,27 @@
+;
+;    Metrix++, Copyright 2009-2013, Metrix++ Project
+;    Link: http://metrixplusplus.sourceforge.net
+;    
+;    This file is a part of Metrix++ Tool.
+;    
+;    Metrix++ is free software: you can redistribute it and/or modify
+;    it under the terms of the GNU General Public License as published by
+;    the Free Software Foundation, version 3 of the License.
+;    
+;    Metrix++ is distributed in the hope that it will be useful,
+;    but WITHOUT ANY WARRANTY; without even the implied warranty of
+;    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;    GNU General Public License for more details.
+;    
+;    You should have received a copy of the GNU General Public License
+;    along with Metrix++.  If not, see <http://www.gnu.org/licenses/>.
+;
+
+[Plugin]
+version: 1.0
+package: std.tools
+module:  info
+class:   Plugin
+depends: mpp.dbf
+actions: info
+enabled: True

+ 87 - 0
mainline/ext/std/tools/info.py

@@ -0,0 +1,87 @@
+#
+#    Metrix++, Copyright 2009-2013, Metrix++ Project
+#    Link: http://metrixplusplus.sourceforge.net
+#    
+#    This file is a part of Metrix++ Tool.
+#    
+#    Metrix++ is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, version 3 of the License.
+#    
+#    Metrix++ is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#    GNU General Public License for more details.
+#    
+#    You should have received a copy of the GNU General Public License
+#    along with Metrix++.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+
+import mpp.api
+import mpp.utils
+
+class Plugin(mpp.api.Plugin, mpp.api.IRunable):
+    
+    def run(self, args):
+        exit_code = 0
+    
+        loader_prev = self.get_plugin_loader().get_plugin('mpp.dbf').get_loader_prev(none_if_empty=True)
+        loader = self.get_plugin_loader().get_plugin('mpp.dbf').get_loader()
+    
+        print "Properties:"
+        for each in loader.iterate_properties():
+            prev_value_str = ""
+            if loader_prev != None:
+                prev = loader_prev.get_property(each.name)
+                if prev == None:
+                    prev_value_str = " [new]"
+                    print "(!)",
+                elif prev != each.value:
+                    prev_value_str = " [modified (was: " + loader_prev.get_property(each.name) + ")]"
+                    print "(!)",
+            print "\t" + each.name + "\t=>\t" + each.value + prev_value_str
+    
+        print "\nMetrics:"
+        for each in sorted(loader.iterate_namespace_names()):
+            for field in sorted(loader.get_namespace(each).iterate_field_names()):
+                prev_value_str = ""
+                if loader_prev != None:
+                    prev = None
+                    prev_namespace = loader_prev.get_namespace(each)
+                    if prev_namespace != None:
+                        prev = prev_namespace.get_field_packager(field)
+                    if prev == None:
+                        prev_value_str = " [new]"
+                        print "(!)",
+                print "\t" + each + ":" + field + prev_value_str
+    
+        print "\nFiles:"
+        paths = None
+        if len(args) == 0:
+            paths = [""]
+        else:
+            paths = args
+        for path in paths:
+            path = mpp.utils.preprocess_path(path)
+    
+            file_iterator = loader.iterate_file_data(path=path)
+            if file_iterator == None:
+                mpp.utils.report_bad_path(path)
+                exit_code += 1
+                continue
+            for each in file_iterator:
+                prev_value_str = ""
+                if loader_prev != None:
+                    prev = loader_prev.load_file_data(each.get_path())
+                    if prev == None:
+                        prev_value_str = " [new]"
+                        print "(!)",
+                    elif prev.get_checksum() != each.get_checksum():
+                        prev_value_str = " [modified]"
+                        print "(!)",
+                print "\t" + each.get_path() + prev_value_str
+            
+        return exit_code
+
+

+ 1 - 1
mainline/ext/std/tools/limit.ini

@@ -22,6 +22,6 @@ version: 1.0
 package: std.tools
 module:  limit
 class:   Plugin
-depends: mpp.dbf, mpp.log, mpp.warn
+depends: mpp.dbf, mpp.warn
 actions: limit
 enabled: True

+ 0 - 3
mainline/ext/std/tools/limit.py

@@ -25,9 +25,6 @@ import mpp.cout
 
 class Plugin(mpp.api.Plugin, mpp.api.IConfigurable, mpp.api.IRunable):
     
-    def __init__(self):
-        pass
-
     def declare_configuration(self, parser):
         parser.add_option("--hotspots", "--hs", default=None, help="If not set (none), all exceeded limits are printed."
                           " If set, exceeded limits are sorted (the worst is the first) and only first HOTSPOTS limits are printed."

+ 1 - 1
mainline/ext/std/tools/view.ini

@@ -22,6 +22,6 @@ version: 1.0
 package: std.tools
 module:  view
 class:   Plugin
-depends: mpp.dbf, mpp.log
+depends: mpp.dbf
 actions: view
 enabled: True

+ 0 - 3
mainline/ext/std/tools/view.py

@@ -23,9 +23,6 @@ import mpp.utils
 
 class Plugin(mpp.api.Plugin, mpp.api.IConfigurable, mpp.api.IRunable):
     
-    def __init__(self):
-        pass
-
     def declare_configuration(self, parser):
         parser.add_option("--format", "--ft", default='xml', choices=['txt', 'xml', 'python'], help="Format of the output data. "
                           "Possible values are 'xml', 'txt' or 'python' [default: %default]")

+ 5 - 5
mainline/tests/general/test_basic/test_help_info_default_stdout.gold.txt

@@ -2,11 +2,6 @@ Usage: metrix++.py info [options] -- [path 1] ... [path N]
 
 Options:
   -h, --help            show this help message and exit
-  --log-level=LOG_LEVEL, --ll=LOG_LEVEL
-                        Defines log level. Possible values are
-                        'DEBUG','INFO','WARNING' or 'ERROR'. Default value is
-                        inherited from environment variable
-                        'METRIXPLUSPLUS_LOG_LEVEL' if set. [default: INFO]
   --db-file=DB_FILE, --dbf=DB_FILE
                         Primary database file to write (by the collector) and
                         post-process (by other tools) [default: ./metrixpp.db]
@@ -17,3 +12,8 @@ Options:
                         it may reduce the processing time significantly. Post-
                         processing tools use it in order to recognise/evaluate
                         change trends. [default: none].
+  --log-level=LOG_LEVEL, --ll=LOG_LEVEL
+                        Defines log level. Possible values are
+                        'DEBUG','INFO','WARNING' or 'ERROR'. Default value is
+                        inherited from environment variable
+                        'METRIXPLUSPLUS_LOG_LEVEL' if set. [default: INFO]

+ 11 - 107
mainline/tools/debug.py

@@ -18,118 +18,22 @@
 #
 
 
-import logging
-import cgi
+import os
 
-import mpp.api
-import mpp.log
-import mpp.cmdparser
-import mpp.dbf
-
-import mpp.utils
+import mpp.internal.loader
 
+import mpp.api
 class Tool(mpp.api.ITool):
     def run(self, tool_args):
         return main(tool_args)
 
 def main(tool_args):
-    log_plugin = mpp.log.Plugin()
-    db_plugin = mpp.dbf.Plugin()
-
-    parser = mpp.cmdparser.MultiOptionParser(usage="Usage: %prog debug [options] -- [path 1] ... [path N]")
-    log_plugin.declare_configuration(parser)
-    db_plugin.declare_configuration(parser)
-    parser.add_option("-m", "--mode", default='dumphtml', choices=['dumphtml'],
-                         help="'dumphtml' - prints html code with code highlights for each given path [default: %default]")
-
-    (options, args) = parser.parse_args(tool_args)
-    log_plugin.configure(options)
-    db_plugin.configure(options)
-
-    log_plugin.initialize()
-    db_plugin.initialize()
-
-    loader = db_plugin.get_loader()
-
-    if options.__dict__['mode'] == 'dumphtml':
-        return dumphtml(args, loader)
-    
-    assert(False)    
-    
-def dumphtml(args, loader):
-    exit_code = 0
-    result = ""
-    result += '<html><body>'
-    for path in args:
-        path = mpp.utils.preprocess_path(path)
-        
-        data = loader.load_file_data(path)
-        if data == None:
-            mpp.utils.report_bad_path(path)
-            exit_code += 1
-            continue
-        
-        file_name = data.get_path()
-        fh = open(file_name, 'r')
-        if fh == None:
-            logging.error("can not open file '" + path + "' for reading")
-            exit_code += 1
-            continue
-        text = fh.read()
-        fh.close()
-        
-        result += '<table><tr><td><pre>'
-        last_pos = 0
-        for marker in data.iterate_markers():
-            result += (cgi.escape(text[last_pos:marker.begin]))
-            if marker.get_type() == data.get_marker_types().STRING:
-                result += ('<span style="color:#0000FF">')
-            elif marker.get_type() == data.get_marker_types().COMMENT:
-                result += ('<span style="color:#009900">')
-            elif marker.get_type() == data.get_marker_types().PREPROCESSOR:
-                result += ('<span style="color:#990000">')
-            else:
-                # TODO add tests for debug tool
-                assert False, "Uknown marker type"
-            result += (cgi.escape(text[marker.begin:marker.end]))
-            result += ('</span>')
-            last_pos = marker.end
-        result += (cgi.escape(text[last_pos:]))
-        last_pos = 0
-        result += ('</pre></td><td><pre>')
-        styles = [('<span style="background-color:#F0F010">',
-                  '<span style="background-color:#F010F0">'),
-                  ('<span style="background-color:#F0F030">',
-                  '<span style="background-color:#F030F0">'),
-                  ('<span style="background-color:#F0F050">',
-                  '<span style="background-color:#F050F0">'),
-                  ('<span style="background-color:#F0F070">',
-                  '<span style="background-color:#F070F0">'),
-                  ('<span style="background-color:#F0F090">',
-                  '<span style="background-color:#F090F0">'),
-                  ('<span style="background-color:#F0F0B0">',
-                  '<span style="background-color:#F0B0F0">'),
-                  ('<span style="background-color:#F0F0D0">',
-                  '<span style="background-color:#F0D0F0">'),
-                  ('<span style="background-color:#F0F0E0">',
-                  '<span style="background-color:#F0E0F0">')]
-        
-        def proc_rec(region_id, file_data, styles, indent, pos):
-            result = (styles[indent % len(styles)][pos % 2])
-            region = file_data.get_region(region_id)
-            result += ('<a href="#line' + str(region.get_cursor()) + '" id=line"' + str(region.get_cursor()) + '"></a>')
-            last_pos = region.get_offset_begin() 
-            for (ind, sub_id) in enumerate(file_data.get_region(region_id).iterate_subregion_ids()):
-                subregion = file_data.get_region(sub_id)
-                result += (cgi.escape(text[last_pos:subregion.get_offset_begin()]))
-                result += proc_rec(sub_id, file_data, styles, indent + 3, ind)
-                last_pos = subregion.get_offset_end()
-            result += (cgi.escape(text[last_pos:region.get_offset_end()]))
-            result += ('</span>')
-            return result
-        result += proc_rec(1, data, styles, 0, 0)
-        result += ('</pre></td></tr></table>')
-    result += ('</body></html>')
-    print result
+    loader = mpp.internal.loader.Loader()
+    mpp_paths = []
+    # TODO document this feature
+    if 'METRIXPLUSPLUS_PATH' in os.environ.keys():
+        mpp_paths = os.environ['METRIXPLUSPLUS_PATH'].split(os.pathsep)
+    args = loader.load('debug', mpp_paths, tool_args)
+    exit_code = loader.run(args)
+    loader.unload()
     return exit_code
-            

+ 11 - 77
mainline/tools/info.py

@@ -18,88 +18,22 @@
 #
 
 
-import mpp.api
-import mpp.dbf
-import mpp.log
-import mpp.cmdparser
+import os
 
-import mpp.utils
+import mpp.internal.loader
 
+import mpp.api
 class Tool(mpp.api.ITool):
     def run(self, tool_args):
         return main(tool_args)
 
 def main(tool_args):
-    exit_code = 0
-    log_plugin = mpp.log.Plugin()
-    db_plugin = mpp.dbf.Plugin()
-
-    parser = mpp.cmdparser.MultiOptionParser(usage="Usage: %prog info [options] -- [path 1] ... [path N]")
-    log_plugin.declare_configuration(parser)
-    db_plugin.declare_configuration(parser)
-
-    (options, args) = parser.parse_args(tool_args)
-    log_plugin.configure(options)
-    db_plugin.configure(options)
-    
-    log_plugin.initialize()
-    db_plugin.initialize()
-
-    loader_prev = db_plugin.get_loader_prev(none_if_empty=True)
-    loader = db_plugin.get_loader()
-
-    print "Properties:"
-    for each in loader.iterate_properties():
-        prev_value_str = ""
-        if loader_prev != None:
-            prev = loader_prev.get_property(each.name)
-            if prev == None:
-                prev_value_str = " [new]"
-                print "(!)",
-            elif prev != each.value:
-                prev_value_str = " [modified (was: " + loader_prev.get_property(each.name) + ")]"
-                print "(!)",
-        print "\t" + each.name + "\t=>\t" + each.value + prev_value_str
-
-    print "\nMetrics:"
-    for each in sorted(loader.iterate_namespace_names()):
-        for field in sorted(loader.get_namespace(each).iterate_field_names()):
-            prev_value_str = ""
-            if loader_prev != None:
-                prev = None
-                prev_namespace = loader_prev.get_namespace(each)
-                if prev_namespace != None:
-                    prev = prev_namespace.get_field_packager(field)
-                if prev == None:
-                    prev_value_str = " [new]"
-                    print "(!)",
-            print "\t" + each + ":" + field + prev_value_str
-
-    print "\nFiles:"
-    paths = None
-    if len(args) == 0:
-        paths = [""]
-    else:
-        paths = args
-    for path in paths:
-        path = mpp.utils.preprocess_path(path)
-
-        file_iterator = loader.iterate_file_data(path=path)
-        if file_iterator == None:
-            mpp.utils.report_bad_path(path)
-            exit_code += 1
-            continue
-        for each in file_iterator:
-            prev_value_str = ""
-            if loader_prev != None:
-                prev = loader_prev.load_file_data(each.get_path())
-                if prev == None:
-                    prev_value_str = " [new]"
-                    print "(!)",
-                elif prev.get_checksum() != each.get_checksum():
-                    prev_value_str = " [modified]"
-                    print "(!)",
-            print "\t" + each.get_path() + prev_value_str
-        
+    loader = mpp.internal.loader.Loader()
+    mpp_paths = []
+    # TODO document this feature
+    if 'METRIXPLUSPLUS_PATH' in os.environ.keys():
+        mpp_paths = os.environ['METRIXPLUSPLUS_PATH'].split(os.pathsep)
+    args = loader.load('info', mpp_paths, tool_args)
+    exit_code = loader.run(args)
+    loader.unload()
     return exit_code
-