Browse Source

Merge pull request #20 from metrixplusplus/feature/#19-add-pypi-package

Feature/#19 add pypi package
prozessorkern 4 years ago
parent
commit
06ea2d0a71
100 changed files with 401 additions and 319 deletions
  1. 31 0
      .github/workflows/python-package.yml
  2. 32 0
      .github/workflows/python-tests.yml
  3. 13 2
      README.md
  4. 1 1
      metrix++.py
  5. 0 0
      metrixpp/__init__.py
  6. 0 0
      metrixpp/ext/__init__.py
  7. 0 0
      metrixpp/ext/std/__init__.py
  8. 0 0
      metrixpp/ext/std/code/__init__.py
  9. 0 0
      metrixpp/ext/std/code/complexity.ini
  10. 7 7
      ext/std/code/complexity.py
  11. 0 0
      metrixpp/ext/std/code/cpp.ini
  12. 19 19
      ext/std/code/cpp.py
  13. 0 0
      metrixpp/ext/std/code/cs.ini
  14. 19 19
      ext/std/code/cs.py
  15. 1 1
      ext/std/code/debug.ini
  16. 12 12
      ext/std/code/debug.py
  17. 0 0
      metrixpp/ext/std/code/filelines.ini
  18. 7 7
      ext/std/code/filelines.py
  19. 0 0
      metrixpp/ext/std/code/java.ini
  20. 16 16
      ext/std/code/java.py
  21. 0 0
      metrixpp/ext/std/code/length.ini
  22. 4 4
      ext/std/code/length.py
  23. 0 0
      metrixpp/ext/std/code/lines.ini
  24. 7 7
      ext/std/code/lines.py
  25. 0 0
      metrixpp/ext/std/code/magic.ini
  26. 9 9
      ext/std/code/magic.py
  27. 0 0
      metrixpp/ext/std/code/member.ini
  28. 25 25
      ext/std/code/member.py
  29. 0 0
      metrixpp/ext/std/code/mi.ini
  30. 8 8
      ext/std/code/mi.py
  31. 0 0
      metrixpp/ext/std/code/test.ini
  32. 8 8
      ext/std/code/test.py
  33. 0 0
      metrixpp/ext/std/code/todo.ini
  34. 10 10
      ext/std/code/todo.py
  35. 0 0
      metrixpp/ext/std/suppress.ini
  36. 16 16
      ext/std/suppress.py
  37. 0 0
      metrixpp/ext/std/tools/__init__.py
  38. 0 0
      metrixpp/ext/std/tools/collect.ini
  39. 14 6
      ext/std/tools/collect.py
  40. 1 1
      ext/std/tools/export.ini
  41. 9 9
      ext/std/tools/export.py
  42. 1 1
      ext/std/tools/info.ini
  43. 12 12
      ext/std/tools/info.py
  44. 1 1
      ext/std/tools/limit.ini
  45. 18 18
      ext/std/tools/limit.py
  46. 1 1
      ext/std/tools/view.ini
  47. 24 24
      ext/std/tools/view.py
  48. 7 18
      metrixpp.py
  49. 0 0
      metrixpp/mpp/__init__.py
  50. 15 15
      mpp/api.py
  51. 0 0
      metrixpp/mpp/cout.py
  52. 1 1
      mpp/dbf.ini
  53. 5 5
      mpp/dbf.py
  54. 0 0
      metrixpp/mpp/internal/__init__.py
  55. 0 0
      metrixpp/mpp/internal/api_impl.py
  56. 0 0
      metrixpp/mpp/internal/dbwrap.py
  57. 38 27
      mpp/internal/loader.py
  58. 0 0
      metrixpp/mpp/internal/py2txt.py
  59. 0 0
      metrixpp/mpp/internal/py2xml.py
  60. 1 1
      mpp/log.ini
  61. 2 2
      mpp/log.py
  62. 4 4
      mpp/utils.py
  63. 0 0
      metrixpp/tests/__init__.py
  64. 2 2
      tests/common.py
  65. 0 0
      metrixpp/tests/general/test_basic.py
  66. 0 0
      metrixpp/tests/general/test_basic/sources/.unused.cpp
  67. 0 0
      metrixpp/tests/general/test_basic/sources/dummy.txt
  68. 0 0
      metrixpp/tests/general/test_basic/sources/file_deleted_in_new_sources.cpp
  69. 0 0
      metrixpp/tests/general/test_basic/sources/simple.cpp
  70. 0 0
      metrixpp/tests/general/test_basic/sources_changed/.unused.cpp
  71. 0 0
      metrixpp/tests/general/test_basic/sources_changed/simple.cpp
  72. 0 0
      metrixpp/tests/general/test_basic/sources_changed/simple2.cpp
  73. 0 0
      metrixpp/tests/general/test_basic/test_export_format_collect_default_stdout.gold.txt
  74. 0 0
      metrixpp/tests/general/test_basic/test_export_format_collect_nest_stdout.gold.txt
  75. 0 0
      metrixpp/tests/general/test_basic/test_export_format_export_nest_per_file_stdout.gold.txt
  76. 0 0
      metrixpp/tests/general/test_basic/test_export_format_export_nest_stdout.gold.txt
  77. 0 0
      metrixpp/tests/general/test_basic/test_export_format_export_python_stdout.gold.txt
  78. 0 0
      metrixpp/tests/general/test_basic/test_export_format_export_txt_stdout.gold.txt
  79. 0 0
      metrixpp/tests/general/test_basic/test_export_format_export_xml_stdout.gold.txt
  80. 0 0
      metrixpp/tests/general/test_basic/test_help_--help_default_stdout.gold.txt
  81. 0 0
      metrixpp/tests/general/test_basic/test_help_collect_default_stdout.gold.txt
  82. 0 0
      metrixpp/tests/general/test_basic/test_help_export_default_stdout.gold.txt
  83. 0 0
      metrixpp/tests/general/test_basic/test_help_info_default_stdout.gold.txt
  84. 0 0
      metrixpp/tests/general/test_basic/test_help_limit_default_stdout.gold.txt
  85. 0 0
      metrixpp/tests/general/test_basic/test_help_unknown_default_stdout.gold.txt
  86. 0 0
      metrixpp/tests/general/test_basic/test_help_view_default_stdout.gold.txt
  87. 0 0
      metrixpp/tests/general/test_basic/test_std_code_magic_collect_default_stdout.gold.txt
  88. 0 0
      metrixpp/tests/general/test_basic/test_std_code_magic_collect_nozeros_stdout.gold.txt
  89. 0 0
      metrixpp/tests/general/test_basic/test_std_code_magic_view_default_stdout.gold.txt
  90. 0 0
      metrixpp/tests/general/test_basic/test_std_code_magic_view_nest_per_file_stdout.gold.txt
  91. 0 0
      metrixpp/tests/general/test_basic/test_std_code_magic_view_nozeros_nest_per_file_stdout.gold.txt
  92. 0 0
      metrixpp/tests/general/test_basic/test_std_code_magic_view_nozeros_stdout.gold.txt
  93. 0 0
      metrixpp/tests/general/test_basic/test_std_complexity_maxindent_collect_default_stdout.gold.txt
  94. 0 0
      metrixpp/tests/general/test_basic/test_std_complexity_maxindent_view_default_stdout.gold.txt
  95. 0 0
      metrixpp/tests/general/test_basic/test_std_complexity_maxindent_view_nest_per_file_stdout.gold.txt
  96. 0 0
      metrixpp/tests/general/test_basic/test_std_filelines_metrics_collect_default_stdout.gold.txt
  97. 0 0
      metrixpp/tests/general/test_basic/test_std_filelines_metrics_view_nest_per_file_stdout.gold.txt
  98. 0 0
      metrixpp/tests/general/test_basic/test_std_filelines_metrics_view_txt_stdout.gold.txt
  99. 0 0
      metrixpp/tests/general/test_basic/test_std_general_metrics_collect_default_stdout.gold.txt
  100. 0 0
      tests/general/test_basic/test_std_general_metrics_view_nest_per_file_stdout.gold.txt

+ 31 - 0
.github/workflows/python-package.yml

@@ -0,0 +1,31 @@
+# This workflows will upload a Python Package using Twine when a release is created
+# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
+
+name: Upload Python Package
+
+on:
+  release:
+    types: [created]
+
+jobs:
+  deploy:
+
+    runs-on: ubuntu-latest
+
+    steps:
+    - uses: actions/checkout@v2
+    - name: Set up Python
+      uses: actions/setup-python@v2
+      with:
+        python-version: '3.x'
+    - name: Install dependencies
+      run: |
+        python -m pip install --upgrade pip
+        pip install setuptools wheel twine
+    - name: Build and publish
+      env:
+        TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
+        TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
+      run: |
+        python setup.py sdist bdist_wheel
+        twine upload dist/*

+ 32 - 0
.github/workflows/python-tests.yml

@@ -0,0 +1,32 @@
+# This workflow will install Python dependencies, run tests with python2 and 3 on windows, macOS an ununtu
+# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
+
+name: Metrix++ Tests
+
+on:
+  push:
+  pull_request:
+
+jobs:
+  test:
+    name: Test on ${{ matrix.os }}
+    runs-on: ${{ matrix.os }}
+    
+    strategy:
+      matrix:
+        python: [2.7, 3.5, 3.6, 3.7, 3.8]
+        os: [ubuntu-latest, windows-latest, macOS-latest]
+
+    steps:
+    - uses: actions/checkout@v2
+    - name: Set up Python ${{ matrix.python }}
+      uses: actions/setup-python@v2
+      with:
+        python-version: ${{ matrix.python }}
+    - name: Install dependencies
+      run: |
+        python -m pip install --upgrade pip
+        pip install -r requirements.txt
+    - name: Run tests
+      run: |
+        python metrix++.py test

+ 13 - 2
README.md

@@ -1,12 +1,23 @@
 # [Metrix++](https://github.com/metrixplusplus/metrixplusplus)
 # [Metrix++](https://github.com/metrixplusplus/metrixplusplus)
+
+![Metrix++ Tests](https://github.com/metrixplusplus/metrixplusplus/workflows/Metrix++%20Tests/badge.svg)
+![Upload Python Package](https://github.com/metrixplusplus/metrixplusplus/workflows/Upload%20Python%20Package/badge.svg)
+
 Metrix++ is an extendable tool for code metrics collection and analysis.
 Metrix++ is an extendable tool for code metrics collection and analysis.
 Check projects documentation for additional information:
 Check projects documentation for additional information:
 * [https://metrixplusplus.github.io/](https://metrixplusplus.github.io/)
 * [https://metrixplusplus.github.io/](https://metrixplusplus.github.io/)
 
 
 Thank you for using the tool!
 Thank you for using the tool!
 
 
-## Download & Install
-In order to get the tool working, [download the archive](https://github.com/metrixplusplus/metrixplusplus/releases)
+## Installation
+
+Metrix++ is published on [PyPi](https://pypi.org/project/metrixpp/) as `metrixpp` and can be installed using pip:
+
+```
+pip install metrixpp
+```
+
+Alternatively you can [download the archive](https://github.com/metrixplusplus/metrixplusplus/releases)
 with the latest stable version and unpack it to some folder.
 with the latest stable version and unpack it to some folder.
 The first run of the tool will trigger the installation within the folder, where it was launched.
 The first run of the tool will trigger the installation within the folder, where it was launched.
 
 

+ 1 - 1
metrix++.py

@@ -6,5 +6,5 @@
 #    
 #    
 
 
 if __name__ == '__main__':
 if __name__ == '__main__':
-    import metrixpp
+    from metrixpp import metrixpp
     metrixpp.start()
     metrixpp.start()

tests/general/test_basic/sources/.unused.cpp → metrixpp/__init__.py


tests/general/test_basic/sources/dummy.txt → metrixpp/ext/__init__.py


ext/std/__init__.py → metrixpp/ext/std/__init__.py


ext/std/code/__init__.py → metrixpp/ext/std/code/__init__.py


ext/std/code/complexity.ini → metrixpp/ext/std/code/complexity.ini


+ 7 - 7
ext/std/code/complexity.py

@@ -5,11 +5,11 @@
 #    This file is a part of Metrix++ Tool.
 #    This file is a part of Metrix++ Tool.
 #    
 #    
 
 
-import mpp.api
+from metrixpp.mpp import api
 
 
 import re
 import re
 
 
-class Plugin(mpp.api.Plugin, mpp.api.MetricPluginMixin, mpp.api.Child, mpp.api.IConfigurable):
+class Plugin(api.Plugin, api.MetricPluginMixin, api.Child, api.IConfigurable):
     
     
     def declare_configuration(self, parser):
     def declare_configuration(self, parser):
         parser.add_option("--std.code.complexity.cyclomatic", "--sccc", action="store_true", default=False,
         parser.add_option("--std.code.complexity.cyclomatic", "--sccc", action="store_true", default=False,
@@ -40,8 +40,8 @@ class Plugin(mpp.api.Plugin, mpp.api.MetricPluginMixin, mpp.api.Child, mpp.api.I
                                 'std.code.cs': self.pattern_cs,
                                 'std.code.cs': self.pattern_cs,
                                 'std.code.java': self.pattern_java
                                 'std.code.java': self.pattern_java
                             },
                             },
-                            marker_type_mask=mpp.api.Marker.T.CODE,
-                            region_type_mask=mpp.api.Region.T.FUNCTION)
+                            marker_type_mask=api.Marker.T.CODE,
+                            region_type_mask=api.Region.T.FUNCTION)
         self.declare_metric(self.is_active_maxindent,
         self.declare_metric(self.is_active_maxindent,
                             self.Field('maxindent', int),
                             self.Field('maxindent', int),
                             {
                             {
@@ -49,8 +49,8 @@ class Plugin(mpp.api.Plugin, mpp.api.MetricPluginMixin, mpp.api.Child, mpp.api.I
                                 'std.code.cs': (self.pattern_indent, self.MaxIndentCounter),
                                 'std.code.cs': (self.pattern_indent, self.MaxIndentCounter),
                                 'std.code.java': (self.pattern_indent, self.MaxIndentCounter),
                                 'std.code.java': (self.pattern_indent, self.MaxIndentCounter),
                             },
                             },
-                            marker_type_mask=mpp.api.Marker.T.CODE,
-                            region_type_mask=mpp.api.Region.T.FUNCTION)
+                            marker_type_mask=api.Marker.T.CODE,
+                            region_type_mask=api.Region.T.FUNCTION)
         
         
         super(Plugin, self).initialize(fields=self.get_fields())
         super(Plugin, self).initialize(fields=self.get_fields())
         
         
@@ -61,7 +61,7 @@ class Plugin(mpp.api.Plugin, mpp.api.MetricPluginMixin, mpp.api.Child, mpp.api.I
                 'std.code.java'
                 'std.code.java'
             ])
             ])
 
 
-    class MaxIndentCounter(mpp.api.MetricPluginMixin.IterAssignCounter):
+    class MaxIndentCounter(api.MetricPluginMixin.IterAssignCounter):
         
         
         def __init__(self, *args, **kwargs):
         def __init__(self, *args, **kwargs):
             super(Plugin.MaxIndentCounter, self).__init__(*args, **kwargs)
             super(Plugin.MaxIndentCounter, self).__init__(*args, **kwargs)

ext/std/code/cpp.ini → metrixpp/ext/std/code/cpp.ini


+ 19 - 19
ext/std/code/cpp.py

@@ -8,10 +8,10 @@
 import re
 import re
 import binascii
 import binascii
 
 
-import mpp.api
-import mpp.cout
+from metrixpp.mpp import api
+from metrixpp.mpp import cout
 
 
-class Plugin(mpp.api.Plugin, mpp.api.Parent, mpp.api.IParser, mpp.api.IConfigurable, mpp.api.ICode):
+class Plugin(api.Plugin, api.Parent, api.IParser, api.IConfigurable, api.ICode):
     
     
     def declare_configuration(self, parser):
     def declare_configuration(self, parser):
         parser.add_option("--std.code.cpp.files", default="*.c,*.h,*.cpp,*.hpp,*.cc,*.hh,*.cxx,*.hxx",
         parser.add_option("--std.code.cpp.files", default="*.c,*.h,*.cpp,*.hpp,*.cc,*.hh,*.cxx,*.hxx",
@@ -22,7 +22,7 @@ class Plugin(mpp.api.Plugin, mpp.api.Parent, mpp.api.IParser, mpp.api.IConfigura
         self.files.sort() # sorted list goes to properties
         self.files.sort() # sorted list goes to properties
         
         
     def initialize(self):
     def initialize(self):
-        mpp.api.Plugin.initialize(self, properties=[
+        api.Plugin.initialize(self, properties=[
             self.Property('files', ','.join(self.files))
             self.Property('files', ','.join(self.files))
         ])
         ])
         self.get_plugin('std.tools.collect').register_parser(self.files, self)
         self.get_plugin('std.tools.collect').register_parser(self.files, self)
@@ -123,17 +123,17 @@ class CppCodeParser(object):
         def add_regions_rec(self, data, blocks):
         def add_regions_rec(self, data, blocks):
             def get_type_id(data, named_type):
             def get_type_id(data, named_type):
                 if named_type == "function":
                 if named_type == "function":
-                    return mpp.api.Region.T.FUNCTION
+                    return api.Region.T.FUNCTION
                 elif named_type == "class":
                 elif named_type == "class":
-                    return mpp.api.Region.T.CLASS
+                    return api.Region.T.CLASS
                 elif named_type == "struct":
                 elif named_type == "struct":
-                    return mpp.api.Region.T.STRUCT
+                    return api.Region.T.STRUCT
                 elif named_type == "union":
                 elif named_type == "union":
-                    return mpp.api.Region.T.STRUCT
+                    return api.Region.T.STRUCT
                 elif named_type == "namespace":
                 elif named_type == "namespace":
-                    return mpp.api.Region.T.NAMESPACE
+                    return api.Region.T.NAMESPACE
                 elif named_type == "__global__":
                 elif named_type == "__global__":
-                    return mpp.api.Region.T.GLOBAL
+                    return api.Region.T.GLOBAL
                 else:
                 else:
                     assert(False)
                     assert(False)
             for each in blocks:
             for each in blocks:
@@ -164,15 +164,15 @@ class CppCodeParser(object):
         for m in re.finditer(self.regex_cpp, text):
         for m in re.finditer(self.regex_cpp, text):
             # Comment
             # Comment
             if text[m.start()] == '/':
             if text[m.start()] == '/':
-                data.add_marker(m.start(), m.end(), mpp.api.Marker.T.COMMENT)
+                data.add_marker(m.start(), m.end(), api.Marker.T.COMMENT)
             
             
             # String
             # String
             elif text[m.start()] == '"' or text[m.start()] == '\'':
             elif text[m.start()] == '"' or text[m.start()] == '\'':
-                data.add_marker(m.start() + 1, m.end() - 1, mpp.api.Marker.T.STRING)
+                data.add_marker(m.start() + 1, m.end() - 1, api.Marker.T.STRING)
             
             
             # Preprocessor (including internal comments)
             # Preprocessor (including internal comments)
             elif text[m.start()] == ' ' or text[m.start()] == '\t' or text[m.start()] == '#':
             elif text[m.start()] == ' ' or text[m.start()] == '\t' or text[m.start()] == '#':
-                data.add_marker(m.start(), m.end(), mpp.api.Marker.T.PREPROCESSOR)
+                data.add_marker(m.start(), m.end(), api.Marker.T.PREPROCESSOR)
 
 
             # Statement end
             # Statement end
             elif text[m.start()] == ';':
             elif text[m.start()] == ';':
@@ -223,9 +223,9 @@ class CppCodeParser(object):
                 if blocks[curblk]['indent_start'] == indent_current:
                 if blocks[curblk]['indent_start'] == indent_current:
                     next_block = reset_next_block(m.end())
                     next_block = reset_next_block(m.end())
                     if curblk == 0:
                     if curblk == 0:
-                        mpp.cout.notify(data.get_path(),
+                        cout.notify(data.get_path(),
                                          cursor_current + len(self.regex_ln.findall(text, cursor_last_pos, m.start())),
                                          cursor_current + len(self.regex_ln.findall(text, cursor_last_pos, m.start())),
-                                         mpp.cout.SEVERITY_WARNING,
+                                         cout.SEVERITY_WARNING,
                                          "Non-matching closing bracket '}' detected.")
                                          "Non-matching closing bracket '}' detected.")
                         count_mismatched_brackets += 1
                         count_mismatched_brackets += 1
                         continue
                         continue
@@ -240,9 +240,9 @@ class CppCodeParser(object):
                 # shift indent left
                 # shift indent left
                 indent_current -= 1
                 indent_current -= 1
                 if indent_current < 0:
                 if indent_current < 0:
-                    mpp.cout.notify(data.get_path(),
+                    cout.notify(data.get_path(),
                                      cursor_current + len(self.regex_ln.findall(text, cursor_last_pos, m.start())),
                                      cursor_current + len(self.regex_ln.findall(text, cursor_last_pos, m.start())),
-                                     mpp.cout.SEVERITY_WARNING,
+                                     cout.SEVERITY_WARNING,
                                      "Non-matching closing bracket '}' detected.")
                                      "Non-matching closing bracket '}' detected.")
                     count_mismatched_brackets += 1
                     count_mismatched_brackets += 1
                     indent_current = 0
                     indent_current = 0
@@ -284,9 +284,9 @@ class CppCodeParser(object):
 
 
         while indent_current > 0:
         while indent_current > 0:
             # log all
             # log all
-            mpp.cout.notify(data.get_path(),
+            cout.notify(data.get_path(),
                              cursor_current + len(self.regex_ln.findall(text, cursor_last_pos, len(text))),
                              cursor_current + len(self.regex_ln.findall(text, cursor_last_pos, len(text))),
-                             mpp.cout.SEVERITY_WARNING,
+                             cout.SEVERITY_WARNING,
                              "Non-matching opening bracket '{' detected.")
                              "Non-matching opening bracket '{' detected.")
             count_mismatched_brackets += 1
             count_mismatched_brackets += 1
             indent_current -= 1
             indent_current -= 1

ext/std/code/cs.ini → metrixpp/ext/std/code/cs.ini


+ 19 - 19
ext/std/code/cs.py

@@ -8,10 +8,10 @@
 import re
 import re
 import binascii
 import binascii
 
 
-import mpp.api
-import mpp.cout
+from metrixpp.mpp import api
+from metrixpp.mpp import cout
 
 
-class Plugin(mpp.api.Plugin, mpp.api.Parent, mpp.api.IParser, mpp.api.IConfigurable, mpp.api.ICode):
+class Plugin(api.Plugin, api.Parent, api.IParser, api.IConfigurable, api.ICode):
     
     
     def declare_configuration(self, parser):
     def declare_configuration(self, parser):
         parser.add_option("--std.code.cs.files", default="*.cs",
         parser.add_option("--std.code.cs.files", default="*.cs",
@@ -22,7 +22,7 @@ class Plugin(mpp.api.Plugin, mpp.api.Parent, mpp.api.IParser, mpp.api.IConfigura
         self.files.sort() # sorted list goes to properties
         self.files.sort() # sorted list goes to properties
         
         
     def initialize(self):
     def initialize(self):
-        mpp.api.Plugin.initialize(self, properties=[
+        api.Plugin.initialize(self, properties=[
             self.Property('files', ','.join(self.files))
             self.Property('files', ','.join(self.files))
         ])
         ])
         self.get_plugin('std.tools.collect').register_parser(self.files, self)
         self.get_plugin('std.tools.collect').register_parser(self.files, self)
@@ -134,17 +134,17 @@ class CsCodeParser(object):
         def add_regions_rec(self, data, blocks):
         def add_regions_rec(self, data, blocks):
             def get_type_id(data, named_type):
             def get_type_id(data, named_type):
                 if named_type == "function":
                 if named_type == "function":
-                    return mpp.api.Region.T.FUNCTION
+                    return api.Region.T.FUNCTION
                 elif named_type == "class":
                 elif named_type == "class":
-                    return mpp.api.Region.T.CLASS
+                    return api.Region.T.CLASS
                 elif named_type == "struct":
                 elif named_type == "struct":
-                    return mpp.api.Region.T.STRUCT
+                    return api.Region.T.STRUCT
                 elif named_type == "namespace":
                 elif named_type == "namespace":
-                    return mpp.api.Region.T.NAMESPACE
+                    return api.Region.T.NAMESPACE
                 elif named_type == "interface":
                 elif named_type == "interface":
-                    return mpp.api.Region.T.INTERFACE
+                    return api.Region.T.INTERFACE
                 elif named_type == "__global__":
                 elif named_type == "__global__":
-                    return mpp.api.Region.T.GLOBAL
+                    return api.Region.T.GLOBAL
                 else:
                 else:
                     assert(False)
                     assert(False)
             for each in blocks:
             for each in blocks:
@@ -175,15 +175,15 @@ class CsCodeParser(object):
         for m in re.finditer(self.regex_cpp, text):
         for m in re.finditer(self.regex_cpp, text):
             # Comment
             # Comment
             if text[m.start()] == '/':
             if text[m.start()] == '/':
-                data.add_marker(m.start(), m.end(), mpp.api.Marker.T.COMMENT)
+                data.add_marker(m.start(), m.end(), api.Marker.T.COMMENT)
             
             
             # String
             # String
             elif text[m.start()] == '"' or text[m.start()] == '\'':
             elif text[m.start()] == '"' or text[m.start()] == '\'':
-                data.add_marker(m.start() + 1, m.end() - 1, mpp.api.Marker.T.STRING)
+                data.add_marker(m.start() + 1, m.end() - 1, api.Marker.T.STRING)
             
             
             # Preprocessor (including internal comments)
             # Preprocessor (including internal comments)
             elif text[m.start()] == ' ' or text[m.start()] == '\t' or text[m.start()] == '#':
             elif text[m.start()] == ' ' or text[m.start()] == '\t' or text[m.start()] == '#':
-                data.add_marker(m.start(), m.end(), mpp.api.Marker.T.PREPROCESSOR)
+                data.add_marker(m.start(), m.end(), api.Marker.T.PREPROCESSOR)
 
 
             # Statement end
             # Statement end
             elif text[m.start()] == ';':
             elif text[m.start()] == ';':
@@ -234,9 +234,9 @@ class CsCodeParser(object):
                 if blocks[curblk]['indent_start'] == indent_current:
                 if blocks[curblk]['indent_start'] == indent_current:
                     next_block = reset_next_block(m.end())
                     next_block = reset_next_block(m.end())
                     if curblk == 0:
                     if curblk == 0:
-                        mpp.cout.notify(data.get_path(),
+                        cout.notify(data.get_path(),
                                          cursor_current + len(self.regex_ln.findall(text, cursor_last_pos, m.start())),
                                          cursor_current + len(self.regex_ln.findall(text, cursor_last_pos, m.start())),
-                                         mpp.cout.SEVERITY_WARNING,
+                                         cout.SEVERITY_WARNING,
                                          "Non-matching closing bracket '}' detected.")
                                          "Non-matching closing bracket '}' detected.")
                         count_mismatched_brackets += 1
                         count_mismatched_brackets += 1
                         continue
                         continue
@@ -251,9 +251,9 @@ class CsCodeParser(object):
                 # shift indent left
                 # shift indent left
                 indent_current -= 1
                 indent_current -= 1
                 if indent_current < 0:
                 if indent_current < 0:
-                    mpp.cout.notify(data.get_path(),
+                    cout.notify(data.get_path(),
                                      cursor_current + len(self.regex_ln.findall(text, cursor_last_pos, m.start())),
                                      cursor_current + len(self.regex_ln.findall(text, cursor_last_pos, m.start())),
-                                     mpp.cout.SEVERITY_WARNING,
+                                     cout.SEVERITY_WARNING,
                                      "Non-matching closing bracket '}' detected.")
                                      "Non-matching closing bracket '}' detected.")
                     count_mismatched_brackets += 1
                     count_mismatched_brackets += 1
                     indent_current = 0
                     indent_current = 0
@@ -296,9 +296,9 @@ class CsCodeParser(object):
 
 
         while indent_current > 0:
         while indent_current > 0:
             # log all
             # log all
-            mpp.cout.notify(data.get_path(),
+            cout.notify(data.get_path(),
                              cursor_current + len(self.regex_ln.findall(text, cursor_last_pos, len(text))),
                              cursor_current + len(self.regex_ln.findall(text, cursor_last_pos, len(text))),
-                             mpp.cout.SEVERITY_WARNING,
+                             cout.SEVERITY_WARNING,
                              "Non-matching opening bracket '{' detected.")
                              "Non-matching opening bracket '{' detected.")
             count_mismatched_brackets += 1
             count_mismatched_brackets += 1
             indent_current -= 1
             indent_current -= 1

+ 1 - 1
ext/std/code/debug.ini

@@ -10,6 +10,6 @@ version: 1.0
 package: std.tools
 package: std.tools
 module:  debug
 module:  debug
 class:   Plugin
 class:   Plugin
-depends: mpp.dbf
+depends: metrixpp.mpp.dbf
 actions: debug
 actions: debug
 enabled: False
 enabled: False

+ 12 - 12
ext/std/code/debug.py

@@ -8,10 +8,10 @@
 import logging
 import logging
 import cgi
 import cgi
 
 
-import mpp.api
-import mpp.utils
+from metrixpp.mpp import api
+from metrixpp.mpp import utils
 
 
-class Plugin(mpp.api.Plugin, mpp.api.IConfigurable, mpp.api.IRunable):
+class Plugin(api.Plugin, api.IConfigurable, api.IRunable):
     
     
     def declare_configuration(self, parser):
     def declare_configuration(self, parser):
         parser.add_option("-m", "--mode", default='dumphtml', choices=['dumphtml'],
         parser.add_option("-m", "--mode", default='dumphtml', choices=['dumphtml'],
@@ -21,7 +21,7 @@ class Plugin(mpp.api.Plugin, mpp.api.IConfigurable, mpp.api.IRunable):
         self.mode = options.__dict__['mode']
         self.mode = options.__dict__['mode']
 
 
     def run(self, args):
     def run(self, args):
-        loader = self.get_plugin('mpp.dbf').get_loader()
+        loader = self.get_plugin('metrixpp.mpp.dbf').get_loader()
     
     
         if self.mode == 'dumphtml':
         if self.mode == 'dumphtml':
             return dumphtml(args, loader)
             return dumphtml(args, loader)
@@ -32,11 +32,11 @@ def dumphtml(args, loader):
     result = ""
     result = ""
     result += '<html><body>'
     result += '<html><body>'
     for path in args:
     for path in args:
-        path = mpp.utils.preprocess_path(path)
+        path = utils.preprocess_path(path)
         
         
         data = loader.load_file_data(path)
         data = loader.load_file_data(path)
         if data == None:
         if data == None:
-            mpp.utils.report_bad_path(path)
+            utils.report_bad_path(path)
             exit_code += 1
             exit_code += 1
             continue
             continue
         
         
@@ -52,15 +52,15 @@ def dumphtml(args, loader):
         # TODO fix highlightning of markers
         # TODO fix highlightning of markers
 #        result += '<table><tr><td><pre>'
 #        result += '<table><tr><td><pre>'
 #        last_pos = 0
 #        last_pos = 0
-#        for marker in data.iterate_markers(filter_group= mpp.api.Marker.T.COMMENT |
-#                                           mpp.api.Marker.T.STRING |
-#                                           mpp.api.Marker.T.PREPROCESSOR):
+#        for marker in data.iterate_markers(filter_group= api.Marker.T.COMMENT |
+#                                           api.Marker.T.STRING |
+#                                           api.Marker.T.PREPROCESSOR):
 #            result += (cgi.escape(text[last_pos:marker.begin]))
 #            result += (cgi.escape(text[last_pos:marker.begin]))
-#            if marker.get_type() == mpp.api.Marker.T.STRING:
+#            if marker.get_type() == api.Marker.T.STRING:
 #                result += ('<span style="color:#0000FF">')
 #                result += ('<span style="color:#0000FF">')
-#            elif marker.get_type() == mpp.api.Marker.T.COMMENT:
+#            elif marker.get_type() == api.Marker.T.COMMENT:
 #                result += ('<span style="color:#009900">')
 #                result += ('<span style="color:#009900">')
-#            elif marker.get_type() == mpp.api.Marker.T.PREPROCESSOR:
+#            elif marker.get_type() == api.Marker.T.PREPROCESSOR:
 #                result += ('<span style="color:#990000">')
 #                result += ('<span style="color:#990000">')
 #            else:
 #            else:
 #                assert False, "Uknown marker type"
 #                assert False, "Uknown marker type"

ext/std/code/filelines.ini → metrixpp/ext/std/code/filelines.ini


+ 7 - 7
ext/std/code/filelines.py

@@ -5,10 +5,10 @@
 #    This file is a part of Metrix++ Tool.
 #    This file is a part of Metrix++ Tool.
 #    
 #    
 
 
-import mpp.api
+from metrixpp.mpp import api
 import re
 import re
 
 
-class Plugin(mpp.api.Plugin, mpp.api.MetricPluginMixin, mpp.api.Child, mpp.api.IConfigurable):
+class Plugin(api.Plugin, api.MetricPluginMixin, api.Child, api.IConfigurable):
     
     
     def declare_configuration(self, parser):
     def declare_configuration(self, parser):
         parser.add_option("--std.code.filelines.code", "--scflc", action="store_true", default=False,
         parser.add_option("--std.code.filelines.code", "--scflc", action="store_true", default=False,
@@ -40,23 +40,23 @@ class Plugin(mpp.api.Plugin, mpp.api.MetricPluginMixin, mpp.api.Child, mpp.api.I
         self.declare_metric(self.is_active_code,
         self.declare_metric(self.is_active_code,
                        self.Field('code', int),
                        self.Field('code', int),
                        self.pattern_line,
                        self.pattern_line,
-                       mpp.api.Marker.T.CODE | mpp.api.Marker.T.STRING,
+                       api.Marker.T.CODE | api.Marker.T.STRING,
                        merge_markers=True)
                        merge_markers=True)
         self.declare_metric(self.is_active_preprocessor,
         self.declare_metric(self.is_active_preprocessor,
                        self.Field('preprocessor', int),
                        self.Field('preprocessor', int),
                        self.pattern_line,
                        self.pattern_line,
-                       mpp.api.Marker.T.PREPROCESSOR)
+                       api.Marker.T.PREPROCESSOR)
         self.declare_metric(self.is_active_comments,
         self.declare_metric(self.is_active_comments,
                        self.Field('comments', int),
                        self.Field('comments', int),
                        self.pattern_line,
                        self.pattern_line,
-                       mpp.api.Marker.T.COMMENT)
+                       api.Marker.T.COMMENT)
         self.declare_metric(self.is_active_total,
         self.declare_metric(self.is_active_total,
                        self.Field('total', int),
                        self.Field('total', int),
                        self.pattern_line,
                        self.pattern_line,
-                       mpp.api.Marker.T.ANY,
+                       api.Marker.T.ANY,
                        merge_markers=True)
                        merge_markers=True)
 
 
         super(Plugin, self).initialize(fields=self.get_fields(), support_regions=False)
         super(Plugin, self).initialize(fields=self.get_fields(), support_regions=False)
 
 
         if self.is_active() == True:
         if self.is_active() == True:
-            self.subscribe_by_parents_interface(mpp.api.ICode)
+            self.subscribe_by_parents_interface(api.ICode)

ext/std/code/java.ini → metrixpp/ext/std/code/java.ini


+ 16 - 16
ext/std/code/java.py

@@ -8,10 +8,10 @@
 import re
 import re
 import binascii
 import binascii
 
 
-import mpp.api
-import mpp.cout
+from metrixpp.mpp import api
+from metrixpp.mpp import cout
 
 
-class Plugin(mpp.api.Plugin, mpp.api.Parent, mpp.api.IParser, mpp.api.IConfigurable, mpp.api.ICode):
+class Plugin(api.Plugin, api.Parent, api.IParser, api.IConfigurable, api.ICode):
     
     
     def declare_configuration(self, parser):
     def declare_configuration(self, parser):
         parser.add_option("--std.code.java.files", default="*.java",
         parser.add_option("--std.code.java.files", default="*.java",
@@ -22,7 +22,7 @@ class Plugin(mpp.api.Plugin, mpp.api.Parent, mpp.api.IParser, mpp.api.IConfigura
         self.files.sort() # sorted list goes to properties
         self.files.sort() # sorted list goes to properties
         
         
     def initialize(self):
     def initialize(self):
-        mpp.api.Plugin.initialize(self, properties=[
+        api.Plugin.initialize(self, properties=[
             self.Property('files', ','.join(self.files))
             self.Property('files', ','.join(self.files))
         ])
         ])
         self.get_plugin('std.tools.collect').register_parser(self.files, self)
         self.get_plugin('std.tools.collect').register_parser(self.files, self)
@@ -111,13 +111,13 @@ class JavaCodeParser(object):
         def add_regions_rec(self, data, blocks):
         def add_regions_rec(self, data, blocks):
             def get_type_id(data, named_type):
             def get_type_id(data, named_type):
                 if named_type == "function":
                 if named_type == "function":
-                    return mpp.api.Region.T.FUNCTION
+                    return api.Region.T.FUNCTION
                 elif named_type == "class":
                 elif named_type == "class":
-                    return mpp.api.Region.T.CLASS
+                    return api.Region.T.CLASS
                 elif named_type == "interface":
                 elif named_type == "interface":
-                    return mpp.api.Region.T.INTERFACE
+                    return api.Region.T.INTERFACE
                 elif named_type == "__global__":
                 elif named_type == "__global__":
-                    return mpp.api.Region.T.GLOBAL
+                    return api.Region.T.GLOBAL
                 else:
                 else:
                     assert(False)
                     assert(False)
             for each in blocks:
             for each in blocks:
@@ -148,11 +148,11 @@ class JavaCodeParser(object):
         for m in re.finditer(self.regex_cpp, text):
         for m in re.finditer(self.regex_cpp, text):
             # Comment
             # Comment
             if text[m.start()] == '/':
             if text[m.start()] == '/':
-                data.add_marker(m.start(), m.end(), mpp.api.Marker.T.COMMENT)
+                data.add_marker(m.start(), m.end(), api.Marker.T.COMMENT)
             
             
             # String
             # String
             elif text[m.start()] == '"' or text[m.start()] == '\'':
             elif text[m.start()] == '"' or text[m.start()] == '\'':
-                data.add_marker(m.start() + 1, m.end() - 1, mpp.api.Marker.T.STRING)
+                data.add_marker(m.start() + 1, m.end() - 1, api.Marker.T.STRING)
             
             
             # Statement end
             # Statement end
             elif text[m.start()] == ';':
             elif text[m.start()] == ';':
@@ -191,9 +191,9 @@ class JavaCodeParser(object):
                 if blocks[curblk]['indent_start'] == indent_current:
                 if blocks[curblk]['indent_start'] == indent_current:
                     next_block = reset_next_block(m.end())
                     next_block = reset_next_block(m.end())
                     if curblk == 0:
                     if curblk == 0:
-                        mpp.cout.notify(data.get_path(),
+                        cout.notify(data.get_path(),
                                          cursor_current + len(self.regex_ln.findall(text, cursor_last_pos, m.start())),
                                          cursor_current + len(self.regex_ln.findall(text, cursor_last_pos, m.start())),
-                                         mpp.cout.SEVERITY_WARNING,
+                                         cout.SEVERITY_WARNING,
                                          "Non-matching closing bracket '}' detected.")
                                          "Non-matching closing bracket '}' detected.")
                         count_mismatched_brackets += 1
                         count_mismatched_brackets += 1
                         continue
                         continue
@@ -208,9 +208,9 @@ class JavaCodeParser(object):
                 # shift indent left
                 # shift indent left
                 indent_current -= 1
                 indent_current -= 1
                 if indent_current < 0:
                 if indent_current < 0:
-                    mpp.cout.notify(data.get_path(),
+                    cout.notify(data.get_path(),
                                      cursor_current + len(self.regex_ln.findall(text, cursor_last_pos, m.start())),
                                      cursor_current + len(self.regex_ln.findall(text, cursor_last_pos, m.start())),
-                                     mpp.cout.SEVERITY_WARNING,
+                                     cout.SEVERITY_WARNING,
                                      "Non-matching closing bracket '}' detected.")
                                      "Non-matching closing bracket '}' detected.")
                     count_mismatched_brackets += 1
                     count_mismatched_brackets += 1
                     indent_current = 0
                     indent_current = 0
@@ -250,9 +250,9 @@ class JavaCodeParser(object):
 
 
         while indent_current > 0:
         while indent_current > 0:
             # log all
             # log all
-            mpp.cout.notify(data.get_path(),
+            cout.notify(data.get_path(),
                              cursor_current + len(self.regex_ln.findall(text, cursor_last_pos, len(text))),
                              cursor_current + len(self.regex_ln.findall(text, cursor_last_pos, len(text))),
-                             mpp.cout.SEVERITY_WARNING,
+                             cout.SEVERITY_WARNING,
                              "Non-matching opening bracket '{' detected.")
                              "Non-matching opening bracket '{' detected.")
             count_mismatched_brackets += 1
             count_mismatched_brackets += 1
             indent_current -= 1
             indent_current -= 1

ext/std/code/length.ini → metrixpp/ext/std/code/length.ini


+ 4 - 4
ext/std/code/length.py

@@ -5,9 +5,9 @@
 #    This file is a part of Metrix++ Tool.
 #    This file is a part of Metrix++ Tool.
 #    
 #    
 
 
-import mpp.api
+from metrixpp.mpp import api
 
 
-class Plugin(mpp.api.Plugin, mpp.api.Child, mpp.api.IConfigurable):
+class Plugin(api.Plugin, api.Child, api.IConfigurable):
     
     
     def declare_configuration(self, parser):
     def declare_configuration(self, parser):
         parser.add_option("--std.code.length.total", "--sclent", action="store_true", default=False,
         parser.add_option("--std.code.length.total", "--sclent", action="store_true", default=False,
@@ -20,10 +20,10 @@ class Plugin(mpp.api.Plugin, mpp.api.Child, mpp.api.IConfigurable):
         fields = []
         fields = []
         if self.is_active == True:
         if self.is_active == True:
             fields.append(self.Field('total', int))
             fields.append(self.Field('total', int))
-        mpp.api.Plugin.initialize(self, fields=fields)
+        api.Plugin.initialize(self, fields=fields)
         
         
         if len(fields) != 0:
         if len(fields) != 0:
-            self.subscribe_by_parents_interface(mpp.api.ICode)
+            self.subscribe_by_parents_interface(api.ICode)
 
 
     def callback(self, parent, data, is_updated):
     def callback(self, parent, data, is_updated):
         is_updated = is_updated or self.is_updated
         is_updated = is_updated or self.is_updated

ext/std/code/lines.ini → metrixpp/ext/std/code/lines.ini


+ 7 - 7
ext/std/code/lines.py

@@ -5,10 +5,10 @@
 #    This file is a part of Metrix++ Tool.
 #    This file is a part of Metrix++ Tool.
 #    
 #    
 
 
-import mpp.api
+from metrixpp.mpp import api
 import re
 import re
 
 
-class Plugin(mpp.api.Plugin, mpp.api.MetricPluginMixin, mpp.api.Child, mpp.api.IConfigurable):
+class Plugin(api.Plugin, api.MetricPluginMixin, api.Child, api.IConfigurable):
     
     
     def declare_configuration(self, parser):
     def declare_configuration(self, parser):
         parser.add_option("--std.code.lines.code", "--sclc", action="store_true", default=False,
         parser.add_option("--std.code.lines.code", "--sclc", action="store_true", default=False,
@@ -40,23 +40,23 @@ class Plugin(mpp.api.Plugin, mpp.api.MetricPluginMixin, mpp.api.Child, mpp.api.I
         self.declare_metric(self.is_active_code,
         self.declare_metric(self.is_active_code,
                        self.Field('code', int),
                        self.Field('code', int),
                        self.pattern_line,
                        self.pattern_line,
-                       mpp.api.Marker.T.CODE | mpp.api.Marker.T.STRING,
+                       api.Marker.T.CODE | api.Marker.T.STRING,
                        merge_markers=True)
                        merge_markers=True)
         self.declare_metric(self.is_active_preprocessor,
         self.declare_metric(self.is_active_preprocessor,
                        self.Field('preprocessor', int),
                        self.Field('preprocessor', int),
                        self.pattern_line,
                        self.pattern_line,
-                       mpp.api.Marker.T.PREPROCESSOR)
+                       api.Marker.T.PREPROCESSOR)
         self.declare_metric(self.is_active_comments,
         self.declare_metric(self.is_active_comments,
                        self.Field('comments', int),
                        self.Field('comments', int),
                        self.pattern_line,
                        self.pattern_line,
-                       mpp.api.Marker.T.COMMENT)
+                       api.Marker.T.COMMENT)
         self.declare_metric(self.is_active_total,
         self.declare_metric(self.is_active_total,
                        self.Field('total', int),
                        self.Field('total', int),
                        self.pattern_line,
                        self.pattern_line,
-                       mpp.api.Marker.T.ANY,
+                       api.Marker.T.ANY,
                        merge_markers=True)
                        merge_markers=True)
 
 
         super(Plugin, self).initialize(fields=self.get_fields())
         super(Plugin, self).initialize(fields=self.get_fields())
 
 
         if self.is_active() == True:
         if self.is_active() == True:
-            self.subscribe_by_parents_interface(mpp.api.ICode)
+            self.subscribe_by_parents_interface(api.ICode)

ext/std/code/magic.ini → metrixpp/ext/std/code/magic.ini


+ 9 - 9
ext/std/code/magic.py

@@ -5,13 +5,13 @@
 #    This file is a part of Metrix++ Tool.
 #    This file is a part of Metrix++ Tool.
 #    
 #    
 
 
-import mpp.api
+from metrixpp.mpp import api
 import re
 import re
 
 
-class Plugin(mpp.api.Plugin,
-             mpp.api.IConfigurable,
-             mpp.api.Child,
-             mpp.api.MetricPluginMixin):
+class Plugin(api.Plugin,
+             api.IConfigurable,
+             api.Child,
+             api.MetricPluginMixin):
     
     
     def declare_configuration(self, parser):
     def declare_configuration(self, parser):
         parser.add_option("--std.code.magic.numbers", "--scmn",
         parser.add_option("--std.code.magic.numbers", "--scmn",
@@ -39,16 +39,16 @@ class Plugin(mpp.api.Plugin,
                              'std.code.cpp': (pattern_to_search_cpp_cs, self.NumbersCounter),
                              'std.code.cpp': (pattern_to_search_cpp_cs, self.NumbersCounter),
                              'std.code.cs': (pattern_to_search_cpp_cs, self.NumbersCounter),
                              'std.code.cs': (pattern_to_search_cpp_cs, self.NumbersCounter),
                             },
                             },
-                            marker_type_mask=mpp.api.Marker.T.CODE,
-                            region_type_mask=mpp.api.Region.T.ANY)
+                            marker_type_mask=api.Marker.T.CODE,
+                            region_type_mask=api.Region.T.ANY)
         
         
         super(Plugin, self).initialize(fields=self.get_fields(),
         super(Plugin, self).initialize(fields=self.get_fields(),
             properties=[self.Property('number.simplier', self.is_active_numbers_simplier)])
             properties=[self.Property('number.simplier', self.is_active_numbers_simplier)])
         
         
         if self.is_active() == True:
         if self.is_active() == True:
-            self.subscribe_by_parents_interface(mpp.api.ICode)
+            self.subscribe_by_parents_interface(api.ICode)
 
 
-    class NumbersCounter(mpp.api.MetricPluginMixin.IterIncrementCounter):
+    class NumbersCounter(api.MetricPluginMixin.IterIncrementCounter):
         def increment(self, match):
         def increment(self, match):
             if (match.group(0).startswith('const') or
             if (match.group(0).startswith('const') or
                 (self.plugin.is_active_numbers_simplier == True and
                 (self.plugin.is_active_numbers_simplier == True and

ext/std/code/member.ini → metrixpp/ext/std/code/member.ini


+ 25 - 25
ext/std/code/member.py

@@ -5,13 +5,13 @@
 #    This file is a part of Metrix++ Tool.
 #    This file is a part of Metrix++ Tool.
 #    
 #    
 
 
-import mpp.api
+from metrixpp.mpp import api
 import re
 import re
 
 
-class Plugin(mpp.api.Plugin,
-             mpp.api.IConfigurable,
-             mpp.api.Child,
-             mpp.api.MetricPluginMixin):
+class Plugin(api.Plugin,
+             api.IConfigurable,
+             api.Child,
+             api.MetricPluginMixin):
     
     
     def declare_configuration(self, parser):
     def declare_configuration(self, parser):
         parser.add_option("--std.code.member.fields", "--scmf",
         parser.add_option("--std.code.member.fields", "--scmf",
@@ -73,9 +73,9 @@ class Plugin(mpp.api.Plugin,
                              'std.code.cpp': pattern_to_search_cpp,
                              'std.code.cpp': pattern_to_search_cpp,
                              'std.code.cs': pattern_to_search_cs,
                              'std.code.cs': pattern_to_search_cs,
                             },
                             },
-                            marker_type_mask=mpp.api.Marker.T.CODE,
-                            region_type_mask=mpp.api.Region.T.CLASS |
-                            mpp.api.Region.T.STRUCT | mpp.api.Region.T.INTERFACE)
+                            marker_type_mask=api.Marker.T.CODE,
+                            region_type_mask=api.Region.T.CLASS |
+                            api.Region.T.STRUCT | api.Region.T.INTERFACE)
         self.declare_metric(self.is_active_globals,
         self.declare_metric(self.is_active_globals,
                             self.Field('globals', int, non_zero=True),
                             self.Field('globals', int, non_zero=True),
                             {
                             {
@@ -83,9 +83,9 @@ class Plugin(mpp.api.Plugin,
                              'std.code.cpp': pattern_to_search_cpp,
                              'std.code.cpp': pattern_to_search_cpp,
                              'std.code.cs': pattern_to_search_cs,
                              'std.code.cs': pattern_to_search_cs,
                             },
                             },
-                            marker_type_mask=mpp.api.Marker.T.CODE,
-                            region_type_mask=mpp.api.Region.T.GLOBAL |
-                            mpp.api.Region.T.NAMESPACE)
+                            marker_type_mask=api.Marker.T.CODE,
+                            region_type_mask=api.Region.T.GLOBAL |
+                            api.Region.T.NAMESPACE)
         self.declare_metric(self.is_active_classes,
         self.declare_metric(self.is_active_classes,
                             self.Field('classes', int, non_zero=True),
                             self.Field('classes', int, non_zero=True),
                             (None, self.ClassesCounter),
                             (None, self.ClassesCounter),
@@ -120,35 +120,35 @@ class Plugin(mpp.api.Plugin,
         super(Plugin, self).initialize(fields=self.get_fields())
         super(Plugin, self).initialize(fields=self.get_fields())
         
         
         if self.is_active() == True:
         if self.is_active() == True:
-            self.subscribe_by_parents_interface(mpp.api.ICode)
+            self.subscribe_by_parents_interface(api.ICode)
 
 
-    class ClassesCounter(mpp.api.MetricPluginMixin.PlainCounter):
+    class ClassesCounter(api.MetricPluginMixin.PlainCounter):
         def count(self, marker, pattern_to_search):
         def count(self, marker, pattern_to_search):
             self.result = sum(1 for unused in self.data.iterate_regions(
             self.result = sum(1 for unused in self.data.iterate_regions(
-                filter_group=mpp.api.Region.T.CLASS, region_id=self.region.get_id()))
+                filter_group=api.Region.T.CLASS, region_id=self.region.get_id()))
 
 
-    class StructCounter(mpp.api.MetricPluginMixin.PlainCounter):
+    class StructCounter(api.MetricPluginMixin.PlainCounter):
         def count(self, marker, pattern_to_search):
         def count(self, marker, pattern_to_search):
             self.result = sum(1 for unused in self.data.iterate_regions(
             self.result = sum(1 for unused in self.data.iterate_regions(
-                filter_group=mpp.api.Region.T.STRUCT, region_id=self.region.get_id()))
+                filter_group=api.Region.T.STRUCT, region_id=self.region.get_id()))
 
 
-    class InterfaceCounter(mpp.api.MetricPluginMixin.PlainCounter):
+    class InterfaceCounter(api.MetricPluginMixin.PlainCounter):
         def count(self, marker, pattern_to_search):
         def count(self, marker, pattern_to_search):
             self.result = sum(1 for unused in self.data.iterate_regions(
             self.result = sum(1 for unused in self.data.iterate_regions(
-                filter_group=mpp.api.Region.T.INTERFACE, region_id=self.region.get_id()))
+                filter_group=api.Region.T.INTERFACE, region_id=self.region.get_id()))
 
 
-    class TypeCounter(mpp.api.MetricPluginMixin.PlainCounter):
+    class TypeCounter(api.MetricPluginMixin.PlainCounter):
         def count(self, marker, pattern_to_search):
         def count(self, marker, pattern_to_search):
             self.result = sum(1 for unused in self.data.iterate_regions(
             self.result = sum(1 for unused in self.data.iterate_regions(
-                filter_group=mpp.api.Region.T.CLASS | mpp.api.Region.T.STRUCT |
-                 mpp.api.Region.T.INTERFACE, region_id=self.region.get_id()))
+                filter_group=api.Region.T.CLASS | api.Region.T.STRUCT |
+                 api.Region.T.INTERFACE, region_id=self.region.get_id()))
 
 
-    class MethodCounter(mpp.api.MetricPluginMixin.PlainCounter):
+    class MethodCounter(api.MetricPluginMixin.PlainCounter):
         def count(self, marker, pattern_to_search):
         def count(self, marker, pattern_to_search):
             self.result = sum(1 for unused in self.data.iterate_regions(
             self.result = sum(1 for unused in self.data.iterate_regions(
-                filter_group=mpp.api.Region.T.FUNCTION, region_id=self.region.get_id()))
+                filter_group=api.Region.T.FUNCTION, region_id=self.region.get_id()))
 
 
-    class NamespaceCounter(mpp.api.MetricPluginMixin.PlainCounter):
+    class NamespaceCounter(api.MetricPluginMixin.PlainCounter):
         def count(self, marker, pattern_to_search):
         def count(self, marker, pattern_to_search):
             self.result = sum(1 for unused in self.data.iterate_regions(
             self.result = sum(1 for unused in self.data.iterate_regions(
-                filter_group=mpp.api.Region.T.NAMESPACE, region_id=self.region.get_id()))
+                filter_group=api.Region.T.NAMESPACE, region_id=self.region.get_id()))

ext/std/code/mi.ini → metrixpp/ext/std/code/mi.ini


+ 8 - 8
ext/std/code/mi.py

@@ -5,12 +5,12 @@
 #    This file is a part of Metrix++ Tool.
 #    This file is a part of Metrix++ Tool.
 #    
 #    
 
 
-import mpp.api
+from metrixpp.mpp import api
 
 
-class Plugin(mpp.api.Plugin,
-             mpp.api.IConfigurable,
-             mpp.api.Child,
-             mpp.api.MetricPluginMixin):
+class Plugin(api.Plugin,
+             api.IConfigurable,
+             api.Child,
+             api.MetricPluginMixin):
     
     
     def declare_configuration(self, parser):
     def declare_configuration(self, parser):
         self.parser = parser
         self.parser = parser
@@ -39,7 +39,7 @@ class Plugin(mpp.api.Plugin,
                              'std.code.lines':(None, self.RankedLinesCounter),
                              'std.code.lines':(None, self.RankedLinesCounter),
                             },
                             },
                             # set none, because this plugin is not interested in parsing the code
                             # set none, because this plugin is not interested in parsing the code
-                            marker_type_mask=mpp.api.Marker.T.NONE)
+                            marker_type_mask=api.Marker.T.NONE)
         
         
         super(Plugin, self).initialize(fields=self.get_fields())
         super(Plugin, self).initialize(fields=self.get_fields())
 
 
@@ -47,10 +47,10 @@ class Plugin(mpp.api.Plugin,
             self.subscribe_by_parents_name('std.code.complexity')
             self.subscribe_by_parents_name('std.code.complexity')
             self.subscribe_by_parents_name('std.code.lines')
             self.subscribe_by_parents_name('std.code.lines')
 
 
-    class RankedComplexityCounter(mpp.api.MetricPluginMixin.RankedCounter):
+    class RankedComplexityCounter(api.MetricPluginMixin.RankedCounter):
         rank_source = ('std.code.complexity', 'cyclomatic')
         rank_source = ('std.code.complexity', 'cyclomatic')
         rank_ranges = [(None, 7), (8, 11), (12, 19), (20, 49), (50, None)]
         rank_ranges = [(None, 7), (8, 11), (12, 19), (20, 49), (50, None)]
     
     
-    class RankedLinesCounter(mpp.api.MetricPluginMixin.RankedCounter):
+    class RankedLinesCounter(api.MetricPluginMixin.RankedCounter):
         rank_source = ('std.code.lines', 'code')
         rank_source = ('std.code.lines', 'code')
         rank_ranges = [(None, 124), (125, 249), (250, 499), (500, 999), (1000, None)]
         rank_ranges = [(None, 124), (125, 249), (250, 499), (500, 999), (1000, None)]

ext/std/code/test.ini → metrixpp/ext/std/code/test.ini


+ 8 - 8
ext/std/code/test.py

@@ -5,16 +5,16 @@
 #    This file is a part of Metrix++ Tool.
 #    This file is a part of Metrix++ Tool.
 #    
 #    
 
 
-import mpp.api
+from metrixpp.mpp import api
 import logging
 import logging
 
 
 # used for testing and development purposes
 # used for testing and development purposes
-class Plugin(mpp.api.Plugin, mpp.api.Child):
+class Plugin(api.Plugin, api.Child):
     
     
     def initialize(self):
     def initialize(self):
         return
         return
         # do not trigger version property set, it is a module for testing purposes
         # do not trigger version property set, it is a module for testing purposes
-        self.subscribe_by_parents_interface(mpp.api.ICode)
+        self.subscribe_by_parents_interface(api.ICode)
 
 
     def callback(self, parent, data, is_updated):
     def callback(self, parent, data, is_updated):
 
 
@@ -23,9 +23,9 @@ class Plugin(mpp.api.Plugin, mpp.api.Child):
         for region in data.iterate_regions():
         for region in data.iterate_regions():
             logging.warn(region.get_name() + " " + str(region.get_cursor()))
             logging.warn(region.get_name() + " " + str(region.get_cursor()))
             for marker in data.iterate_markers(region_id=region.get_id(),
             for marker in data.iterate_markers(region_id=region.get_id(),
-                                               filter_group = mpp.api.Marker.T.ANY,
+                                               filter_group = api.Marker.T.ANY,
                                                exclude_children = True):
                                                exclude_children = True):
-                logging.warn("\tMarker: " + mpp.api.Marker.T().to_str(marker.get_type()) +
+                logging.warn("\tMarker: " + api.Marker.T().to_str(marker.get_type()) +
                              " " + str(marker.get_offset_begin()) + " " + str(marker.get_offset_end()) +
                              " " + str(marker.get_offset_begin()) + " " + str(marker.get_offset_end()) +
                              " >>>" + text[marker.get_offset_begin():marker.get_offset_end()] + "<<<")
                              " >>>" + text[marker.get_offset_begin():marker.get_offset_end()] + "<<<")
                 text_comb += text[marker.get_offset_begin():marker.get_offset_end()]
                 text_comb += text[marker.get_offset_begin():marker.get_offset_end()]
@@ -33,9 +33,9 @@ class Plugin(mpp.api.Plugin, mpp.api.Child):
 
 
         text_comb = ""
         text_comb = ""
         for marker in data.iterate_markers(region_id=1,
         for marker in data.iterate_markers(region_id=1,
-                                           filter_group = mpp.api.Marker.T.ANY,
+                                           filter_group = api.Marker.T.ANY,
                                            exclude_children = False):
                                            exclude_children = False):
-            logging.warn("\tMarker: " + mpp.api.Marker.T().to_str(marker.get_type()) +
+            logging.warn("\tMarker: " + api.Marker.T().to_str(marker.get_type()) +
                          " " + str(marker.get_offset_begin()) + " " + str(marker.get_offset_end()) +
                          " " + str(marker.get_offset_begin()) + " " + str(marker.get_offset_end()) +
                          " >>>" + text[marker.get_offset_begin():marker.get_offset_end()] + "<<<")
                          " >>>" + text[marker.get_offset_begin():marker.get_offset_end()] + "<<<")
             text_comb += text[marker.get_offset_begin():marker.get_offset_end()]
             text_comb += text[marker.get_offset_begin():marker.get_offset_end()]
@@ -45,7 +45,7 @@ class Plugin(mpp.api.Plugin, mpp.api.Child):
         for region in data.iterate_regions():
         for region in data.iterate_regions():
             logging.warn(region.get_name() + " " + str(region.get_cursor()))
             logging.warn(region.get_name() + " " + str(region.get_cursor()))
             for marker in data.iterate_markers(region_id=region.get_id(),
             for marker in data.iterate_markers(region_id=region.get_id(),
-                                               filter_group = mpp.api.Marker.T.ANY,
+                                               filter_group = api.Marker.T.ANY,
                                                exclude_children = True,
                                                exclude_children = True,
                                                merge = True):
                                                merge = True):
                 logging.warn("\tMarker: merged" + 
                 logging.warn("\tMarker: merged" + 

ext/std/code/todo.ini → metrixpp/ext/std/code/todo.ini


+ 10 - 10
ext/std/code/todo.py

@@ -5,13 +5,13 @@
 #    This file is a part of Metrix++ Tool.
 #    This file is a part of Metrix++ Tool.
 #    
 #    
 
 
-import mpp.api
+from metrixpp.mpp import api
 import re
 import re
 
 
-class Plugin(mpp.api.Plugin,
-             mpp.api.IConfigurable,
-             mpp.api.Child,
-             mpp.api.MetricPluginMixin):
+class Plugin(api.Plugin,
+             api.IConfigurable,
+             api.Child,
+             api.MetricPluginMixin):
     
     
     def declare_configuration(self, parser):
     def declare_configuration(self, parser):
         self.parser = parser
         self.parser = parser
@@ -42,16 +42,16 @@ class Plugin(mpp.api.Plugin,
         self.declare_metric(self.is_active_comments,
         self.declare_metric(self.is_active_comments,
                             self.Field('comments', int, non_zero=True),
                             self.Field('comments', int, non_zero=True),
                             self.pattern_to_search,
                             self.pattern_to_search,
-                            marker_type_mask=mpp.api.Marker.T.COMMENT,
-                            region_type_mask=mpp.api.Region.T.ANY)
+                            marker_type_mask=api.Marker.T.COMMENT,
+                            region_type_mask=api.Region.T.ANY)
         self.declare_metric(self.is_active_strings,
         self.declare_metric(self.is_active_strings,
                             self.Field('strings', int, non_zero=True),
                             self.Field('strings', int, non_zero=True),
                             self.pattern_to_search,
                             self.pattern_to_search,
-                            marker_type_mask=mpp.api.Marker.T.STRING,
-                            region_type_mask=mpp.api.Region.T.ANY)
+                            marker_type_mask=api.Marker.T.STRING,
+                            region_type_mask=api.Region.T.ANY)
         
         
         super(Plugin, self).initialize(fields=self.get_fields(),
         super(Plugin, self).initialize(fields=self.get_fields(),
             properties=[self.Property('tags', ','.join(self.tags_list))])
             properties=[self.Property('tags', ','.join(self.tags_list))])
         
         
         if self.is_active() == True:
         if self.is_active() == True:
-            self.subscribe_by_parents_interface(mpp.api.ICode)
+            self.subscribe_by_parents_interface(api.ICode)

ext/std/suppress.ini → metrixpp/ext/std/suppress.ini


+ 16 - 16
ext/std/suppress.py

@@ -5,12 +5,12 @@
 #    This file is a part of Metrix++ Tool.
 #    This file is a part of Metrix++ Tool.
 #    
 #    
 
 
-import mpp.api
-import mpp.cout
+from metrixpp.mpp import api
+from metrixpp.mpp import cout
 
 
 import re
 import re
 
 
-class Plugin(mpp.api.Plugin, mpp.api.Child, mpp.api.IConfigurable):
+class Plugin(api.Plugin, api.Child, api.IConfigurable):
     
     
     def declare_configuration(self, parser):
     def declare_configuration(self, parser):
         parser.add_option("--std.suppress", "--ss", action="store_true", default=False,
         parser.add_option("--std.suppress", "--ss", action="store_true", default=False,
@@ -30,15 +30,15 @@ class Plugin(mpp.api.Plugin, mpp.api.Child, mpp.api.IConfigurable):
             fields.append(self.Field('count', int, non_zero=True))
             fields.append(self.Field('count', int, non_zero=True))
             fields.append(self.Field('list', str))
             fields.append(self.Field('list', str))
         # - init per regions table
         # - init per regions table
-        mpp.api.Plugin.initialize(self, fields=fields)
+        api.Plugin.initialize(self, fields=fields)
         # - init per file table
         # - init per file table
-        mpp.api.Plugin.initialize(self,
+        api.Plugin.initialize(self,
                                    namespace = self.get_name() + '.file',
                                    namespace = self.get_name() + '.file',
                                    support_regions = False,
                                    support_regions = False,
                                    fields=fields)
                                    fields=fields)
         
         
         if len(fields) != 0:
         if len(fields) != 0:
-            self.subscribe_by_parents_interface(mpp.api.ICode)
+            self.subscribe_by_parents_interface(api.ICode)
 
 
     # suppress pattern
     # suppress pattern
     pattern = re.compile(r'''metrix[+][+][:][ \t]+suppress[ \t]+([^ \t\r\n\*]+)''')
     pattern = re.compile(r'''metrix[+][+][:][ \t]+suppress[ \t]+([^ \t\r\n\*]+)''')
@@ -54,7 +54,7 @@ class Plugin(mpp.api.Plugin, mpp.api.Child, mpp.api.IConfigurable):
                 list_text = []
                 list_text = []
                 last_comment_end = None
                 last_comment_end = None
                 for marker in data.iterate_markers(
                 for marker in data.iterate_markers(
-                                filter_group = mpp.api.Marker.T.COMMENT,
+                                filter_group = api.Marker.T.COMMENT,
                                 region_id = region.get_id(),
                                 region_id = region.get_id(),
                                 exclude_children = True):
                                 exclude_children = True):
                     
                     
@@ -67,11 +67,11 @@ class Plugin(mpp.api.Plugin, mpp.api.Child, mpp.api.IConfigurable):
                     matches = self.pattern.findall(text, marker.get_offset_begin(), marker.get_offset_end())
                     matches = self.pattern.findall(text, marker.get_offset_begin(), marker.get_offset_end())
                     for m in matches:
                     for m in matches:
                         namespace_name, field = m.split(':')
                         namespace_name, field = m.split(':')
-                        db_loader = self.get_plugin('mpp.dbf').get_loader()
+                        db_loader = self.get_plugin('metrixpp.mpp.dbf').get_loader()
                         namespace = db_loader.get_namespace(namespace_name)
                         namespace = db_loader.get_namespace(namespace_name)
                         if namespace == None or namespace.check_field(field) == False:
                         if namespace == None or namespace.check_field(field) == False:
-                            mpp.cout.notify(data.get_path(), region.get_cursor(),
-                                                  mpp.cout.SEVERITY_WARNING,
+                            cout.notify(data.get_path(), region.get_cursor(),
+                                                  cout.SEVERITY_WARNING,
                                                   "Suppressed metric '" + namespace_name + ":" + field +
                                                   "Suppressed metric '" + namespace_name + ":" + field +
                                                     "' is not being collected",
                                                     "' is not being collected",
                                                   [("Metric name", namespace_name + ":" + field),
                                                   [("Metric name", namespace_name + ":" + field),
@@ -79,8 +79,8 @@ class Plugin(mpp.api.Plugin, mpp.api.Child, mpp.api.IConfigurable):
                             continue
                             continue
                         if namespace.are_regions_supported() == False:
                         if namespace.are_regions_supported() == False:
                             if region.get_id() != 1:
                             if region.get_id() != 1:
-                                mpp.cout.notify(data.get_path(), region.get_cursor(),
-                                                  mpp.cout.SEVERITY_WARNING,
+                                cout.notify(data.get_path(), region.get_cursor(),
+                                                  cout.SEVERITY_WARNING,
                                                   "Suppressed metric '" + namespace_name + ":" + field +
                                                   "Suppressed metric '" + namespace_name + ":" + field +
                                                     "' is attributed to a file, not a region. "
                                                     "' is attributed to a file, not a region. "
                                                     "Remove it or move to the beginning of the file.",
                                                     "Remove it or move to the beginning of the file.",
@@ -89,8 +89,8 @@ class Plugin(mpp.api.Plugin, mpp.api.Child, mpp.api.IConfigurable):
                                 continue
                                 continue
                             
                             
                             if m in file_list_text:
                             if m in file_list_text:
-                                mpp.cout.notify(data.get_path(), region.get_cursor(),
-                                              mpp.cout.SEVERITY_WARNING,
+                                cout.notify(data.get_path(), region.get_cursor(),
+                                              cout.SEVERITY_WARNING,
                                               "Duplicate suppression of the metric '" +
                                               "Duplicate suppression of the metric '" +
                                                namespace_name + ":" + field + "'",
                                                namespace_name + ":" + field + "'",
                                               [("Metric name", namespace_name + ":" + field),
                                               [("Metric name", namespace_name + ":" + field),
@@ -102,8 +102,8 @@ class Plugin(mpp.api.Plugin, mpp.api.Child, mpp.api.IConfigurable):
                             continue
                             continue
                         
                         
                         if m in list_text:
                         if m in list_text:
-                            mpp.cout.notify(data.get_path(), region.get_cursor(),
-                                          mpp.cout.SEVERITY_WARNING,
+                            cout.notify(data.get_path(), region.get_cursor(),
+                                          cout.SEVERITY_WARNING,
                                           "Duplicate suppression of the metric '" +
                                           "Duplicate suppression of the metric '" +
                                            namespace_name + ":" + field + "'",
                                            namespace_name + ":" + field + "'",
                                           [("Metric name", namespace_name + ":" + field),
                                           [("Metric name", namespace_name + ":" + field),

ext/std/tools/__init__.py → metrixpp/ext/std/tools/__init__.py


ext/std/tools/collect.ini → metrixpp/ext/std/tools/collect.ini


+ 14 - 6
ext/std/tools/collect.py

@@ -6,7 +6,7 @@
 #    
 #    
 
 
 
 
-import mpp.api
+from metrixpp.mpp import api
 
 
 import re
 import re
 import os
 import os
@@ -17,7 +17,7 @@ import binascii
 import fnmatch
 import fnmatch
 import multiprocessing.pool
 import multiprocessing.pool
 
 
-class Plugin(mpp.api.Plugin, mpp.api.Parent, mpp.api.IConfigurable, mpp.api.IRunable):
+class Plugin(api.Plugin, api.Parent, api.IConfigurable, api.IRunable):
     
     
     def __init__(self):
     def __init__(self):
         self.reader = DirectoryReader()
         self.reader = DirectoryReader()
@@ -65,8 +65,8 @@ class Plugin(mpp.api.Plugin, mpp.api.Parent, mpp.api.IConfigurable, mpp.api.IRun
         if self.is_size_enabled == True:
         if self.is_size_enabled == True:
             fields.append(self.Field('size', int))
             fields.append(self.Field('size', int))
         super(Plugin, self).initialize(namespace='std.general', support_regions=False, fields=fields)
         super(Plugin, self).initialize(namespace='std.general', support_regions=False, fields=fields)
-        self.add_exclude_file(self.get_plugin('mpp.dbf').get_dbfile_path())
-        self.add_exclude_file(self.get_plugin('mpp.dbf').get_dbfile_prev_path())
+        self.add_exclude_file(self.get_plugin('metrixpp.mpp.dbf').get_dbfile_path())
+        self.add_exclude_file(self.get_plugin('metrixpp.mpp.dbf').get_dbfile_prev_path())
         
         
     def run(self, args):
     def run(self, args):
         if len(args) == 0:
         if len(args) == 0:
@@ -144,12 +144,20 @@ class DirectoryReader():
                         f = open(full_path, 'rU');
                         f = open(full_path, 'rU');
                         text = f.read();
                         text = f.read();
                         # getting along with the different string handling of python 2 and 3
                         # getting along with the different string handling of python 2 and 3
-                        if sys.version_info[0] < 3:
+                        # trying to get along with different encodings to get the tests running
+                        # on windows and linux
+                        try:
+                            text = text.encode(f.encoding)
+                        except:
+                            pass
+                        try:
                             text = text.decode('utf-8')
                             text = text.decode('utf-8')
+                        except:
+                            pass
                         f.close()
                         f.close()
                         checksum = binascii.crc32(text.encode('utf8')) & 0xffffffff # to match python 3
                         checksum = binascii.crc32(text.encode('utf8')) & 0xffffffff # to match python 3
                         
                         
-                        db_loader = plugin.get_plugin('mpp.dbf').get_loader()
+                        db_loader = plugin.get_plugin('metrixpp.mpp.dbf').get_loader()
                         (data, is_updated) = db_loader.create_file_data(norm_path, checksum, text)
                         (data, is_updated) = db_loader.create_file_data(norm_path, checksum, text)
                         procerrors = parser.process(plugin, data, is_updated)
                         procerrors = parser.process(plugin, data, is_updated)
                         if plugin.is_proctime_enabled == True:
                         if plugin.is_proctime_enabled == True:

+ 1 - 1
ext/std/tools/export.ini

@@ -10,6 +10,6 @@ version: 1.0
 package: std.tools
 package: std.tools
 module:  export
 module:  export
 class:   Plugin
 class:   Plugin
-depends: mpp.dbf
+depends: metrixpp.mpp.dbf
 actions: export
 actions: export
 enabled: True
 enabled: True

+ 9 - 9
ext/std/tools/export.py

@@ -5,16 +5,16 @@
 #    This file is a part of Metrix++ Tool.
 #    This file is a part of Metrix++ Tool.
 #    
 #    
 
 
-import mpp.api
-import mpp.utils
+from metrixpp.mpp import api
+from metrixpp.mpp import utils
 
 
 import csv
 import csv
 
 
-class Plugin(mpp.api.Plugin, mpp.api.IRunable):
+class Plugin(api.Plugin, api.IRunable):
 
 
     def run(self, args):
     def run(self, args):
-        self.loader_prev = self.get_plugin('mpp.dbf').get_loader_prev()
-        self.loader = self.get_plugin('mpp.dbf').get_loader()
+        self.loader_prev = self.get_plugin('metrixpp.mpp.dbf').get_loader_prev()
+        self.loader = self.get_plugin('metrixpp.mpp.dbf').get_loader()
     
     
         paths = None
         paths = None
         if len(args) == 0:
         if len(args) == 0:
@@ -44,11 +44,11 @@ class Plugin(mpp.api.Plugin, mpp.api.IRunable):
         csvWriter.writerow(columnNames)
         csvWriter.writerow(columnNames)
         
         
         for path in paths:
         for path in paths:
-            path = mpp.utils.preprocess_path(path)
+            path = utils.preprocess_path(path)
             
             
             files = self.loader.iterate_file_data(path)
             files = self.loader.iterate_file_data(path)
             if files == None:
             if files == None:
-                mpp.utils.report_bad_path(path)
+                utils.report_bad_path(path)
                 exit_code += 1
                 exit_code += 1
                 continue
                 continue
                 
                 
@@ -56,10 +56,10 @@ class Plugin(mpp.api.Plugin, mpp.api.IRunable):
                 matcher = None
                 matcher = None
                 file_data_prev = self.loader_prev.load_file_data(file_data.get_path())
                 file_data_prev = self.loader_prev.load_file_data(file_data.get_path())
                 if file_data_prev != None:
                 if file_data_prev != None:
-                    matcher = mpp.utils.FileRegionsMatcher(file_data, file_data_prev)
+                    matcher = utils.FileRegionsMatcher(file_data, file_data_prev)
                 for reg in file_data.iterate_regions():
                 for reg in file_data.iterate_regions():
                     per_reg_data = []
                     per_reg_data = []
-                    per_reg_data.append(mpp.api.Region.T().to_str(reg.get_type()))
+                    per_reg_data.append(api.Region.T().to_str(reg.get_type()))
                     if matcher != None and matcher.is_matched(reg.get_id()):
                     if matcher != None and matcher.is_matched(reg.get_id()):
                         per_reg_data.append(matcher.is_modified(reg.get_id()))
                         per_reg_data.append(matcher.is_modified(reg.get_id()))
                     else:
                     else:

+ 1 - 1
ext/std/tools/info.ini

@@ -10,6 +10,6 @@ version: 1.0
 package: std.tools
 package: std.tools
 module:  info
 module:  info
 class:   Plugin
 class:   Plugin
-depends: mpp.dbf
+depends: metrixpp.mpp.dbf
 actions: info
 actions: info
 enabled: True
 enabled: True

+ 12 - 12
ext/std/tools/info.py

@@ -5,19 +5,19 @@
 #    This file is a part of Metrix++ Tool.
 #    This file is a part of Metrix++ Tool.
 #    
 #    
 
 
-import mpp.api
-import mpp.cout
-import mpp.utils
+from metrixpp.mpp import api
+from metrixpp.mpp import cout
+from metrixpp.mpp import utils
 
 
 import os
 import os
 
 
-class Plugin(mpp.api.Plugin, mpp.api.IRunable):
+class Plugin(api.Plugin, api.IRunable):
     
     
     def run(self, args):
     def run(self, args):
         exit_code = 0
         exit_code = 0
     
     
-        loader_prev = self.get_plugin('mpp.dbf').get_loader_prev(none_if_empty=True)
-        loader = self.get_plugin('mpp.dbf').get_loader()
+        loader_prev = self.get_plugin('metrixpp.mpp.dbf').get_loader_prev(none_if_empty=True)
+        loader = self.get_plugin('metrixpp.mpp.dbf').get_loader()
     
     
         details = []
         details = []
         for each in loader.iterate_properties():
         for each in loader.iterate_properties():
@@ -29,13 +29,13 @@ class Plugin(mpp.api.Plugin, mpp.api.IRunable):
                 elif prev != each.value:
                 elif prev != each.value:
                     prev_value_str = " [modified (was: " + loader_prev.get_property(each.name) + ")]"
                     prev_value_str = " [modified (was: " + loader_prev.get_property(each.name) + ")]"
             details.append((each.name, each.value + prev_value_str))
             details.append((each.name, each.value + prev_value_str))
-        path = self.get_plugin('mpp.dbf').get_dbfile_path()
+        path = self.get_plugin('metrixpp.mpp.dbf').get_dbfile_path()
         if ('METRIXPLUSPLUS_TEST_MODE' in list(os.environ.keys()) and
         if ('METRIXPLUSPLUS_TEST_MODE' in list(os.environ.keys()) and
              os.environ['METRIXPLUSPLUS_TEST_MODE'] == "True"):
              os.environ['METRIXPLUSPLUS_TEST_MODE'] == "True"):
             # in tests, paths come as full paths, strip it for consistent gold files
             # in tests, paths come as full paths, strip it for consistent gold files
             # TODO: if there are other path-like arguments, it is better to think about other solution
             # TODO: if there are other path-like arguments, it is better to think about other solution
             path = os.path.basename(path)
             path = os.path.basename(path)
-        mpp.cout.notify(path, '', mpp.cout.SEVERITY_INFO, 'Created using plugins and settings:', details)
+        cout.notify(path, '', cout.SEVERITY_INFO, 'Created using plugins and settings:', details)
     
     
         details = []
         details = []
         for each in sorted(loader.iterate_namespace_names()):
         for each in sorted(loader.iterate_namespace_names()):
@@ -49,7 +49,7 @@ class Plugin(mpp.api.Plugin, mpp.api.IRunable):
                     if prev == False:
                     if prev == False:
                         prev_value_str = " [new]"
                         prev_value_str = " [new]"
                 details.append((each + ':' + field,  prev_value_str))
                 details.append((each + ':' + field,  prev_value_str))
-        mpp.cout.notify(path, '', mpp.cout.SEVERITY_INFO, 'Collected metrics:', details)
+        cout.notify(path, '', cout.SEVERITY_INFO, 'Collected metrics:', details)
     
     
         paths = None
         paths = None
         if len(args) == 0:
         if len(args) == 0:
@@ -58,11 +58,11 @@ class Plugin(mpp.api.Plugin, mpp.api.IRunable):
             paths = args
             paths = args
         for path in paths:
         for path in paths:
             details = []
             details = []
-            path = mpp.utils.preprocess_path(path)
+            path = utils.preprocess_path(path)
     
     
             file_iterator = loader.iterate_file_data(path=path)
             file_iterator = loader.iterate_file_data(path=path)
             if file_iterator == None:
             if file_iterator == None:
-                mpp.utils.report_bad_path(path)
+                utils.report_bad_path(path)
                 exit_code += 1
                 exit_code += 1
                 continue
                 continue
             for each in file_iterator:
             for each in file_iterator:
@@ -74,7 +74,7 @@ class Plugin(mpp.api.Plugin, mpp.api.IRunable):
                     elif prev.get_checksum() != each.get_checksum():
                     elif prev.get_checksum() != each.get_checksum():
                         prev_value_str = " [modified]"
                         prev_value_str = " [modified]"
                 details.append((each.get_path(), '{0:#x}'.format(each.get_checksum()) + prev_value_str))
                 details.append((each.get_path(), '{0:#x}'.format(each.get_checksum()) + prev_value_str))
-            mpp.cout.notify(path, '', mpp.cout.SEVERITY_INFO, 'Processed files and checksums:', details)
+            cout.notify(path, '', cout.SEVERITY_INFO, 'Processed files and checksums:', details)
             
             
         return exit_code
         return exit_code
 
 

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

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

+ 18 - 18
ext/std/tools/limit.py

@@ -8,11 +8,11 @@
 import logging
 import logging
 import re
 import re
 
 
-import mpp.api
-import mpp.utils
-import mpp.cout
+from metrixpp.mpp import api
+from metrixpp.mpp import utils
+from metrixpp.mpp import cout
 
 
-class Plugin(mpp.api.Plugin, mpp.api.IConfigurable, mpp.api.IRunable):
+class Plugin(api.Plugin, api.IConfigurable, api.IRunable):
     
     
     MODE_NEW     = 0x01
     MODE_NEW     = 0x01
     MODE_TREND   = 0x03
     MODE_TREND   = 0x03
@@ -78,7 +78,7 @@ class Plugin(mpp.api.Plugin, mpp.api.IConfigurable, mpp.api.IRunable):
             def __repr__(self):
             def __repr__(self):
                 return "'{0}:{1}' {2} {3} [applied to '{4}' region type(s)]".format(
                 return "'{0}:{1}' {2} {3} [applied to '{4}' region type(s)]".format(
                         self.namespace, self.field, self.filter[1], self.limit,
                         self.namespace, self.field, self.filter[1], self.limit,
-                        mpp.api.Region.T().to_str(self.region_types))
+                        api.Region.T().to_str(self.region_types))
         
         
         self.limits = []
         self.limits = []
         pattern = re.compile(r'''([^:]+)[:]([^:]+)[:]([-+]?[0-9]+(?:[.][0-9]+)?)(?:[:](.+))?''')
         pattern = re.compile(r'''([^:]+)[:]([^:]+)[:]([-+]?[0-9]+(?:[.][0-9]+)?)(?:[:](.+))?''')
@@ -91,13 +91,13 @@ class Plugin(mpp.api.Plugin, mpp.api.IConfigurable, mpp.api.IRunable):
                 if match.group(4) != None:
                 if match.group(4) != None:
                     for region_type in match.group(4).split(','):
                     for region_type in match.group(4).split(','):
                         region_type = region_type.strip()
                         region_type = region_type.strip()
-                        group_id = mpp.api.Region.T().from_str(region_type)
+                        group_id = api.Region.T().from_str(region_type)
                         if group_id == None:
                         if group_id == None:
                             self.parser.error(
                             self.parser.error(
                                     "option --max-limit: uknown region type (allowed: global, class, struct, namespace, function, interface, any): " + region_type)
                                     "option --max-limit: uknown region type (allowed: global, class, struct, namespace, function, interface, any): " + region_type)
                         region_types |= group_id
                         region_types |= group_id
                 else:
                 else:
-                    region_types = mpp.api.Region.T().ANY
+                    region_types = api.Region.T().ANY
                 limit = Limit("max", float(match.group(3)), match.group(1), match.group(2),
                 limit = Limit("max", float(match.group(3)), match.group(1), match.group(2),
                         (match.group(2), '>', float(match.group(3))), region_types, each)
                         (match.group(2), '>', float(match.group(3))), region_types, each)
                 self.limits.append(limit)
                 self.limits.append(limit)
@@ -110,20 +110,20 @@ class Plugin(mpp.api.Plugin, mpp.api.IConfigurable, mpp.api.IRunable):
                 if match.group(4) != None:
                 if match.group(4) != None:
                     for region_type in match.group(4).split(','):
                     for region_type in match.group(4).split(','):
                         region_type = region_type.strip()
                         region_type = region_type.strip()
-                        group_id = mpp.api.Region.T().from_str(region_type)
+                        group_id = api.Region.T().from_str(region_type)
                         if group_id == None:
                         if group_id == None:
                             self.parser.error(
                             self.parser.error(
                                     "option --max-limit: uknown region type (allowed: global, class, struct, namespace, function, interface, any): " + region_type)
                                     "option --max-limit: uknown region type (allowed: global, class, struct, namespace, function, interface, any): " + region_type)
                         region_types |= group_id
                         region_types |= group_id
                 else:
                 else:
-                    region_types = mpp.api.Region.T().ANY
+                    region_types = api.Region.T().ANY
                 limit = Limit("min", float(match.group(3)), match.group(1), match.group(2),
                 limit = Limit("min", float(match.group(3)), match.group(1), match.group(2),
                         (match.group(2), '<', float(match.group(3))), region_types, each)
                         (match.group(2), '<', float(match.group(3))), region_types, each)
                 self.limits.append(limit)
                 self.limits.append(limit)
 
 
     def initialize(self):
     def initialize(self):
         super(Plugin, self).initialize()
         super(Plugin, self).initialize()
-        db_loader = self.get_plugin('mpp.dbf').get_loader()
+        db_loader = self.get_plugin('metrixpp.mpp.dbf').get_loader()
         self._verify_namespaces(db_loader.iterate_namespace_names())
         self._verify_namespaces(db_loader.iterate_namespace_names())
         for each in db_loader.iterate_namespace_names():
         for each in db_loader.iterate_namespace_names():
             self._verify_fields(each, db_loader.get_namespace(each).iterate_field_names())
             self._verify_fields(each, db_loader.get_namespace(each).iterate_field_names())
@@ -173,8 +173,8 @@ def main(plugin, args):
     
     
     exit_code = 0
     exit_code = 0
 
 
-    loader_prev = plugin.get_plugin('mpp.dbf').get_loader_prev()
-    loader = plugin.get_plugin('mpp.dbf').get_loader()
+    loader_prev = plugin.get_plugin('metrixpp.mpp.dbf').get_loader_prev()
+    loader = plugin.get_plugin('metrixpp.mpp.dbf').get_loader()
     
     
     paths = None
     paths = None
     if len(args) == 0:
     if len(args) == 0:
@@ -188,7 +188,7 @@ def main(plugin, args):
         modified_file_ids = get_list_of_modified_files(loader, loader_prev)
         modified_file_ids = get_list_of_modified_files(loader, loader_prev)
         
         
     for path in paths:
     for path in paths:
-        path = mpp.utils.preprocess_path(path)
+        path = utils.preprocess_path(path)
         
         
         for limit in plugin.iterate_limits():
         for limit in plugin.iterate_limits():
             warns_count = 0
             warns_count = 0
@@ -214,7 +214,7 @@ def main(plugin, args):
                                                    sort_by=sort_by,
                                                    sort_by=sort_by,
                                                    limit_by=limit_by)
                                                    limit_by=limit_by)
             if selected_data == None:
             if selected_data == None:
-                mpp.utils.report_bad_path(path)
+                utils.report_bad_path(path)
                 exit_code += 1
                 exit_code += 1
                 continue
                 continue
             
             
@@ -231,14 +231,14 @@ def main(plugin, args):
                         diff = 0
                         diff = 0
                         is_modified = False
                         is_modified = False
                     else:
                     else:
-                        matcher = mpp.utils.FileRegionsMatcher(file_data, file_data_prev)
+                        matcher = utils.FileRegionsMatcher(file_data, file_data_prev)
                         prev_id = matcher.get_prev_id(select_data.get_region().get_id())
                         prev_id = matcher.get_prev_id(select_data.get_region().get_id())
                         if matcher.is_matched(select_data.get_region().get_id()):
                         if matcher.is_matched(select_data.get_region().get_id()):
                             if matcher.is_modified(select_data.get_region().get_id()):
                             if matcher.is_modified(select_data.get_region().get_id()):
                                 is_modified = True
                                 is_modified = True
                             else:
                             else:
                                 is_modified = False
                                 is_modified = False
-                            diff = mpp.api.DiffData(select_data,
+                            diff = api.DiffData(select_data,
                                                            file_data_prev.get_region(prev_id)).get_data(limit.namespace, limit.field)
                                                            file_data_prev.get_region(prev_id)).get_data(limit.namespace, limit.field)
 
 
                 if (plugin.is_mode_matched(limit.limit,
                 if (plugin.is_mode_matched(limit.limit,
@@ -273,7 +273,7 @@ def main(plugin, args):
                 if limit_warnings != None:
                 if limit_warnings != None:
                     limit_warnings -= 1
                     limit_warnings -= 1
                     
                     
-            mpp.cout.notify(path, None, mpp.cout.SEVERITY_INFO, "{0} regions exceeded the limit {1}".format(warns_count, str(limit)))
+            cout.notify(path, None, cout.SEVERITY_INFO, "{0} regions exceeded the limit {1}".format(warns_count, str(limit)))
 
 
     return exit_code
     return exit_code
 
 
@@ -328,7 +328,7 @@ def report_limit_exceeded(path, cursor, namespace, field, region_name,
                ("Change trend", '{0:{1}}'.format(trend_value, '+' if trend_value else '')),
                ("Change trend", '{0:{1}}'.format(trend_value, '+' if trend_value else '')),
                ("Limit", stat_limit),
                ("Limit", stat_limit),
                ("Suppressed", is_suppressed)]
                ("Suppressed", is_suppressed)]
-    mpp.cout.notify(path, cursor, mpp.cout.SEVERITY_WARNING, message, details)
+    cout.notify(path, cursor, cout.SEVERITY_WARNING, message, details)
 
 
     
     
     
     

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

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

+ 24 - 24
ext/std/tools/view.py

@@ -8,13 +8,13 @@
 import logging
 import logging
 import sys
 import sys
 
 
-import mpp.api
-import mpp.utils
-import mpp.cout
+from metrixpp.mpp import api
+from metrixpp.mpp import utils
+from metrixpp.mpp import cout
 
 
 DIGIT_COUNT = 8
 DIGIT_COUNT = 8
 
 
-class Plugin(mpp.api.Plugin, mpp.api.IConfigurable, mpp.api.IRunable):
+class Plugin(api.Plugin, api.IConfigurable, api.IRunable):
     
     
     MODE_NEW     = 0x01
     MODE_NEW     = 0x01
     MODE_TOUCHED = 0x03
     MODE_TOUCHED = 0x03
@@ -55,8 +55,8 @@ class Plugin(mpp.api.Plugin, mpp.api.IConfigurable, mpp.api.IRunable):
             self.parser.error("option --scope-mode: The mode '" + options.__dict__['scope_mode'] + "' requires '--db-file-prev' option set")
             self.parser.error("option --scope-mode: The mode '" + options.__dict__['scope_mode'] + "' requires '--db-file-prev' option set")
 
 
     def run(self, args):
     def run(self, args):
-        loader_prev = self.get_plugin('mpp.dbf').get_loader_prev()
-        loader = self.get_plugin('mpp.dbf').get_loader()
+        loader_prev = self.get_plugin('metrixpp.mpp.dbf').get_loader_prev()
+        loader = self.get_plugin('metrixpp.mpp.dbf').get_loader()
     
     
         paths = None
         paths = None
         if len(args) == 0:
         if len(args) == 0:
@@ -83,7 +83,7 @@ def export_to_str(out_format, paths, loader, loader_prev, nest_regions, dist_col
         result += "{'view': ["
         result += "{'view': ["
 
 
     for (ind, path) in enumerate(paths):
     for (ind, path) in enumerate(paths):
-        path = mpp.utils.preprocess_path(path)
+        path = utils.preprocess_path(path)
         
         
         aggregated_data, aggregated_data_prev = load_aggregated_data_with_mode(loader, loader_prev, path , mode)
         aggregated_data, aggregated_data_prev = load_aggregated_data_with_mode(loader, loader_prev, path , mode)
         
         
@@ -95,7 +95,7 @@ def export_to_str(out_format, paths, loader, loader_prev, nest_regions, dist_col
             subdirs = sorted(aggregated_data.get_subdirs())
             subdirs = sorted(aggregated_data.get_subdirs())
             subfiles = sorted(aggregated_data.get_subfiles())
             subfiles = sorted(aggregated_data.get_subfiles())
         else:
         else:
-            mpp.utils.report_bad_path(path)
+            utils.report_bad_path(path)
             exit_code += 1
             exit_code += 1
         aggregated_data_tree = append_suppressions(path, aggregated_data_tree, loader, mode)
         aggregated_data_tree = append_suppressions(path, aggregated_data_tree, loader, mode)
 
 
@@ -123,12 +123,12 @@ def export_to_str(out_format, paths, loader, loader_prev, nest_regions, dist_col
         if out_format == 'txt':
         if out_format == 'txt':
             cout_txt(data, loader)
             cout_txt(data, loader)
         elif out_format == 'xml':
         elif out_format == 'xml':
-            result += mpp.utils.serialize_to_xml(data, root_name = "data", digitCount = DIGIT_COUNT) + "\n"
+            result += utils.serialize_to_xml(data, root_name = "data", digitCount = DIGIT_COUNT) + "\n"
         elif out_format == 'python':
         elif out_format == 'python':
             postfix = ""
             postfix = ""
             if ind < len(paths) - 1:
             if ind < len(paths) - 1:
                 postfix = ", "
                 postfix = ", "
-            result += mpp.utils.serialize_to_python(data, root_name = "data") + postfix
+            result += utils.serialize_to_python(data, root_name = "data") + postfix
 
 
     if out_format == 'xml':
     if out_format == 'xml':
         result += "</view>"
         result += "</view>"
@@ -144,7 +144,7 @@ def load_aggregated_data_with_mode(loader, loader_prev, path, mode):
     else:
     else:
         assert(mode == Plugin.MODE_NEW or mode == Plugin.MODE_TOUCHED)
         assert(mode == Plugin.MODE_NEW or mode == Plugin.MODE_TOUCHED)
         
         
-        class AggregatedFilteredData(mpp.api.AggregatedData):
+        class AggregatedFilteredData(api.AggregatedData):
             
             
             def __init__(self, loader, path):
             def __init__(self, loader, path):
                 super(AggregatedFilteredData, self).__init__(loader, path)
                 super(AggregatedFilteredData, self).__init__(loader, path)
@@ -245,7 +245,7 @@ def load_aggregated_data_with_mode(loader, loader_prev, path, mode):
                         result._append_data(file_data)
                         result._append_data(file_data)
                         result_prev._append_data(file_data_prev)
                         result_prev._append_data(file_data_prev)
                     # process regions separately
                     # process regions separately
-                    matcher = mpp.utils.FileRegionsMatcher(file_data, file_data_prev)
+                    matcher = utils.FileRegionsMatcher(file_data, file_data_prev)
                     prev_reg_ids = set()
                     prev_reg_ids = set()
                     for region in file_data.iterate_regions():
                     for region in file_data.iterate_regions():
                         prev_id = matcher.get_prev_id(region.get_id())
                         prev_id = matcher.get_prev_id(region.get_id())
@@ -290,7 +290,7 @@ def append_regions(file_data_tree, file_data, file_data_prev, nest_regions):
     if file_data_prev != None:
     if file_data_prev != None:
         file_data_tree = append_diff(file_data_tree,
         file_data_tree = append_diff(file_data_tree,
                                      file_data_prev.get_data_tree())
                                      file_data_prev.get_data_tree())
-        regions_matcher = mpp.utils.FileRegionsMatcher(file_data, file_data_prev)
+        regions_matcher = utils.FileRegionsMatcher(file_data, file_data_prev)
     
     
     if nest_regions == False:
     if nest_regions == False:
         regions = []
         regions = []
@@ -303,7 +303,7 @@ def append_regions(file_data_tree, file_data, file_data_prev, nest_regions):
                                                region_data_prev.get_data_tree())
                                                region_data_prev.get_data_tree())
                 is_modified = regions_matcher.is_modified(region.get_id())
                 is_modified = regions_matcher.is_modified(region.get_id())
             regions.append({"info": {"name" : region.name,
             regions.append({"info": {"name" : region.name,
-                                     'type': mpp.api.Region.T().to_str(region.get_type()),
+                                     'type': api.Region.T().to_str(region.get_type()),
                                      'modified': is_modified,
                                      'modified': is_modified,
                                      'cursor' : region.cursor,
                                      'cursor' : region.cursor,
                                      'line_begin': region.line_begin,
                                      'line_begin': region.line_begin,
@@ -323,7 +323,7 @@ def append_regions(file_data_tree, file_data, file_data_prev, nest_regions):
                                                region_data_prev.get_data_tree())
                                                region_data_prev.get_data_tree())
                 is_modified = regions_matcher.is_modified(region.get_id())
                 is_modified = regions_matcher.is_modified(region.get_id())
             result = {"info": {"name" : region.name,
             result = {"info": {"name" : region.name,
-                               'type' : mpp.api.Region.T().to_str(region.get_type()),
+                               'type' : api.Region.T().to_str(region.get_type()),
                                'modified': is_modified,
                                'modified': is_modified,
                                'cursor' : region.cursor,
                                'cursor' : region.cursor,
                                'line_begin': region.line_begin,
                                'line_begin': region.line_begin,
@@ -543,9 +543,9 @@ def cout_txt_regions(path, regions, indent = 0):
                 if field in list(diff_data.keys()):
                 if field in list(diff_data.keys()):
                     diff_str = " [" + ("+" if diff_data[field] >= 0 else "") + str(diff_data[field]) + "]"
                     diff_str = " [" + ("+" if diff_data[field] >= 0 else "") + str(diff_data[field]) + "]"
                 details.append((namespace + ":" + field, str(region['data'][namespace][field]) + diff_str))
                 details.append((namespace + ":" + field, str(region['data'][namespace][field]) + diff_str))
-        mpp.cout.notify(path,
+        cout.notify(path,
                         region['info']['cursor'],
                         region['info']['cursor'],
-                        mpp.cout.SEVERITY_INFO,
+                        cout.SEVERITY_INFO,
                         "Metrics per '" + region['info']['name']+ "' region",
                         "Metrics per '" + region['info']['name']+ "' region",
                         details,
                         details,
                         indent=indent)
                         indent=indent)
@@ -571,9 +571,9 @@ def cout_txt(data, loader):
                     diff_str = " [" + ("+" if diff_data[field] >= 0 else "") + str(diff_data[field]) + "]"
                     diff_str = " [" + ("+" if diff_data[field] >= 0 else "") + str(diff_data[field]) + "]"
                 details.append((namespace + ":" + field, str(data['file-data'][namespace][field]) + diff_str))
                 details.append((namespace + ":" + field, str(data['file-data'][namespace][field]) + diff_str))
     if len(details) > 0:
     if len(details) > 0:
-        mpp.cout.notify(data['info']['path'],
+        cout.notify(data['info']['path'],
                     0,
                     0,
-                    mpp.cout.SEVERITY_INFO,
+                    cout.SEVERITY_INFO,
                     "Metrics per file",
                     "Metrics per file",
                     details)
                     details)
 
 
@@ -634,15 +634,15 @@ def cout_txt(data, loader):
                 else:
                 else:
                     metric_str = str(bar['metric'])
                     metric_str = str(bar['metric'])
                 
                 
-                metric_str = (" " * (mpp.cout.DETAILS_OFFSET - len(metric_str) - 1)) + metric_str
+                metric_str = (" " * (cout.DETAILS_OFFSET - len(metric_str) - 1)) + metric_str
                 count_str = str(bar['count'])
                 count_str = str(bar['count'])
                 count_str = ((" " * (count_str_len - len(count_str))) + count_str + diff_str + "\t")
                 count_str = ((" " * (count_str_len - len(count_str))) + count_str + diff_str + "\t")
                 details.append((metric_str,
                 details.append((metric_str,
                                 "{0:.3f}".format(bar['ratio']) + " : " + "{0:.3f}".format(sum_ratio) +  " : " +
                                 "{0:.3f}".format(bar['ratio']) + " : " + "{0:.3f}".format(sum_ratio) +  " : " +
                                 count_str + ('|' * int(bar['ratio']*100))))
                                 count_str + ('|' * int(bar['ratio']*100))))
-            mpp.cout.notify(data['info']['path'],
+            cout.notify(data['info']['path'],
                     '', # no line number
                     '', # no line number
-                    mpp.cout.SEVERITY_INFO,
+                    cout.SEVERITY_INFO,
                     "Overall metrics for '" + namespace + ":" + field + "' metric",
                     "Overall metrics for '" + namespace + ":" + field + "' metric",
                     details)
                     details)
     details = []
     details = []
@@ -651,9 +651,9 @@ def cout_txt(data, loader):
     for each in sorted(data['subfiles']):
     for each in sorted(data['subfiles']):
         details.append(('File', each))
         details.append(('File', each))
     if len(details) > 0: 
     if len(details) > 0: 
-        mpp.cout.notify(data['info']['path'],
+        cout.notify(data['info']['path'],
                 '', # no line number
                 '', # no line number
-                mpp.cout.SEVERITY_INFO,
+                cout.SEVERITY_INFO,
                 "Directory content:",
                 "Directory content:",
                 details)
                 details)
     
     

+ 7 - 18
metrixpp.py

@@ -9,42 +9,31 @@ import time
 import sys
 import sys
 import logging
 import logging
 import os
 import os
-import subprocess
 import itertools
 import itertools
 
 
-import mpp.log
-import mpp.internal.loader
+from .mpp import log
+from .mpp.internal import loader as plugin_loader
 
 
 def main():
 def main():
     
     
     os.environ['METRIXPLUSPLUS_INSTALL_DIR'] = os.path.dirname(os.path.abspath(__file__))
     os.environ['METRIXPLUSPLUS_INSTALL_DIR'] = os.path.dirname(os.path.abspath(__file__))
-    
-    exemode = None
-    if len(sys.argv[1:]) != 0:
-        exemode = sys.argv[1]
-    if exemode != "-R" and exemode != "-D":
-        exemode = '-D' # TODO implement install and release mode
-        # inject '-D' or '-R' option
-        #profile_args = ['-m', 'cProfile']
-        profile_args = []
-        exit(subprocess.call(itertools.chain([sys.executable], profile_args, [sys.argv[0], '-D'], sys.argv[1:])))
 
 
     command = ""
     command = ""
-    if len(sys.argv[1:]) > 1:
-        command = sys.argv[2]
+    if len(sys.argv) > 1:
+        command = sys.argv[1]
 
 
-    loader = mpp.internal.loader.Loader()
+    loader = plugin_loader.Loader()
     mpp_paths = []
     mpp_paths = []
     if 'METRIXPLUSPLUS_PATH' in list(os.environ.keys()):
     if 'METRIXPLUSPLUS_PATH' in list(os.environ.keys()):
         mpp_paths = os.environ['METRIXPLUSPLUS_PATH'].split(os.pathsep)
         mpp_paths = os.environ['METRIXPLUSPLUS_PATH'].split(os.pathsep)
-    args = loader.load(command, mpp_paths, sys.argv[3:])
+    args = loader.load(command, mpp_paths, sys.argv[2:])
     exit_code = loader.run(args)
     exit_code = loader.run(args)
     loader.unload()
     loader.unload()
     return exit_code
     return exit_code
     
     
 def start():
 def start():
     ts = time.time()
     ts = time.time()
-    mpp.log.set_default_format()
+    log.set_default_format()
 
 
     exit_code = main()
     exit_code = main()
     time_spent = round((time.time() - ts), 2)
     time_spent = round((time.time() - ts), 2)

mpp/__init__.py → metrixpp/mpp/__init__.py


+ 15 - 15
mpp/api.py

@@ -8,8 +8,8 @@
 import os.path
 import os.path
 import sys
 import sys
 
 
-import mpp.internal.dbwrap
-import mpp.internal.api_impl
+from metrixpp.mpp.internal import dbwrap
+from metrixpp.mpp.internal import api_impl
 
 
 class InterfaceNotImplemented(Exception):
 class InterfaceNotImplemented(Exception):
     def __init__(self, obj):
     def __init__(self, obj):
@@ -151,7 +151,7 @@ class LoadableData(Data):
         for column_name in list(row.keys()):
         for column_name in list(row.keys()):
             try:
             try:
                 packager = namespace_obj._get_field_packager(column_name)
                 packager = namespace_obj._get_field_packager(column_name)
-            except mpp.internal.api_impl.PackagerError:
+            except api_impl.PackagerError:
                 continue
                 continue
             if row[column_name] == None:
             if row[column_name] == None:
                 continue
                 continue
@@ -686,7 +686,7 @@ class Namespace(object):
         else:
         else:
             for column in self.db.iterate_columns(name):
             for column in self.db.iterate_columns(name):
                 self.add_field(column.name,
                 self.add_field(column.name,
-                               mpp.internal.api_impl.PackagerFactory().get_python_type(column.sql_type),
+                               api_impl.PackagerFactory().get_python_type(column.sql_type),
                                non_zero=column.non_zero)
                                non_zero=column.non_zero)
         
         
     def get_name(self):
     def get_name(self):
@@ -698,7 +698,7 @@ class Namespace(object):
     def add_field(self, field_name, python_type, non_zero=False):
     def add_field(self, field_name, python_type, non_zero=False):
         if not isinstance(field_name, str):
         if not isinstance(field_name, str):
             raise Namespace.FieldError(field_name, "field_name not a string")
             raise Namespace.FieldError(field_name, "field_name not a string")
-        packager = mpp.internal.api_impl.PackagerFactory().create(python_type, non_zero)
+        packager = api_impl.PackagerFactory().create(python_type, non_zero)
         if field_name in list(self.fields.keys()):
         if field_name in list(self.fields.keys()):
             raise Namespace.FieldError(field_name, "double used")
             raise Namespace.FieldError(field_name, "double used")
         self.fields[field_name] = packager
         self.fields[field_name] = packager
@@ -716,34 +716,34 @@ class Namespace(object):
     def check_field(self, field_name):
     def check_field(self, field_name):
         try:
         try:
             self._get_field_packager(field_name)
             self._get_field_packager(field_name)
-        except mpp.internal.api_impl.PackagerError:
+        except api_impl.PackagerError:
             return False
             return False
         return True
         return True
 
 
     def get_field_sql_type(self, field_name):
     def get_field_sql_type(self, field_name):
         try:
         try:
             return self._get_field_packager(field_name).get_sql_type()
             return self._get_field_packager(field_name).get_sql_type()
-        except mpp.internal.api_impl.PackagerError:
+        except api_impl.PackagerError:
             raise Namespace.FieldError(field_name, 'does not exist')
             raise Namespace.FieldError(field_name, 'does not exist')
 
 
     def get_field_python_type(self, field_name):
     def get_field_python_type(self, field_name):
         try:
         try:
             return self._get_field_packager(field_name).get_python_type()
             return self._get_field_packager(field_name).get_python_type()
-        except mpp.internal.api_impl.PackagerError:
+        except api_impl.PackagerError:
             raise Namespace.FieldError(field_name, 'does not exist')
             raise Namespace.FieldError(field_name, 'does not exist')
 
 
 
 
     def is_field_non_zero(self, field_name):
     def is_field_non_zero(self, field_name):
         try:
         try:
             return self._get_field_packager(field_name).is_non_zero()
             return self._get_field_packager(field_name).is_non_zero()
-        except mpp.internal.api_impl.PackagerError:
+        except api_impl.PackagerError:
             raise Namespace.FieldError(field_name, 'does not exist')
             raise Namespace.FieldError(field_name, 'does not exist')
 
 
     def _get_field_packager(self, field_name):
     def _get_field_packager(self, field_name):
         if field_name in list(self.fields.keys()):
         if field_name in list(self.fields.keys()):
             return self.fields[field_name]
             return self.fields[field_name]
         else:
         else:
-            raise mpp.internal.api_impl.PackagerError("unknown field " + field_name + " requested")
+            raise api_impl.PackagerError("unknown field " + field_name + " requested")
     
     
 class Loader(object):
 class Loader(object):
     
     
@@ -753,7 +753,7 @@ class Loader(object):
         self.last_file_data = None # for performance boost reasons
         self.last_file_data = None # for performance boost reasons
     
     
     def create_database(self, dbfile, previous_db = None):
     def create_database(self, dbfile, previous_db = None):
-        self.db = mpp.internal.dbwrap.Database()
+        self.db = dbwrap.Database()
         try:
         try:
             self.db.create(dbfile, clone_from=previous_db)
             self.db.create(dbfile, clone_from=previous_db)
         except:
         except:
@@ -761,7 +761,7 @@ class Loader(object):
         return True
         return True
         
         
     def open_database(self, dbfile, read_only = True):
     def open_database(self, dbfile, read_only = True):
-        self.db = mpp.internal.dbwrap.Database()
+        self.db = dbwrap.Database()
         if os.path.exists(dbfile) == False:
         if os.path.exists(dbfile) == False:
             return False
             return False
         try:
         try:
@@ -861,7 +861,7 @@ class Loader(object):
                     
                     
                     try:
                     try:
                         packager = space._get_field_packager(each[0])
                         packager = space._get_field_packager(each[0])
-                    except mpp.internal.api_impl.PackagerError:
+                    except api_impl.PackagerError:
                         raise Loader.DataNotPackable(namespace, each[0], each[1], None, "The field has not been found")
                         raise Loader.DataNotPackable(namespace, each[0], each[1], None, "The field has not been found")
         
         
                     if space.support_regions != support_regions:
                     if space.support_regions != support_regions:
@@ -871,7 +871,7 @@ class Loader(object):
                         packed_data = packager.pack(each[1])
                         packed_data = packager.pack(each[1])
                         if packed_data == None:
                         if packed_data == None:
                             continue
                             continue
-                    except mpp.internal.api_impl.PackagerError:
+                    except api_impl.PackagerError:
                         raise Loader.DataNotPackable(namespace, each[0], each[1], packager, "Packager raised exception")
                         raise Loader.DataNotPackable(namespace, each[0], each[1], packager, "Packager raised exception")
                     
                     
                     yield (each[0], packed_data)
                     yield (each[0], packed_data)
@@ -1065,7 +1065,7 @@ class Plugin(BasePlugin):
         if hasattr(self, 'is_updated') == False:
         if hasattr(self, 'is_updated') == False:
             self.is_updated = False # original initialization
             self.is_updated = False # original initialization
 
 
-        db_loader = self.get_plugin('mpp.dbf').get_loader()
+        db_loader = self.get_plugin('metrixpp.mpp.dbf').get_loader()
 
 
         if namespace == None:
         if namespace == None:
             namespace = self.get_name()
             namespace = self.get_name()

mpp/cout.py → metrixpp/mpp/cout.py


+ 1 - 1
mpp/dbf.ini

@@ -7,7 +7,7 @@
 
 
 [Plugin]
 [Plugin]
 version: 1.0
 version: 1.0
-package: mpp
+package: metrixpp.mpp
 module:  dbf
 module:  dbf
 class:   Plugin
 class:   Plugin
 depends: None
 depends: None

+ 5 - 5
mpp/dbf.py

@@ -5,12 +5,12 @@
 #    This file is a part of Metrix++ Tool.
 #    This file is a part of Metrix++ Tool.
 #    
 #    
 
 
-import mpp.api
+from metrixpp.mpp import api
 
 
 import os.path
 import os.path
 import logging
 import logging
 
 
-class Plugin(mpp.api.Plugin, mpp.api.IConfigurable):
+class Plugin(api.Plugin, api.IConfigurable):
     
     
     def declare_configuration(self, parser):
     def declare_configuration(self, parser):
         if self.get_action() == 'collect':
         if self.get_action() == 'collect':
@@ -46,16 +46,16 @@ class Plugin(mpp.api.Plugin, mpp.api.IConfigurable):
                 except:
                 except:
                     logging.warn("Failure in removing file: " + self.dbfile)
                     logging.warn("Failure in removing file: " + self.dbfile)
     
     
-            self.loader = mpp.api.Loader()
+            self.loader = api.Loader()
             created = self.loader.create_database(self.dbfile, previous_db = self.dbfile_prev)
             created = self.loader.create_database(self.dbfile, previous_db = self.dbfile_prev)
             if created == False:
             if created == False:
                 self.parser.error("option --db-file: Can not create file '{0}'".format(self.dbfile))
                 self.parser.error("option --db-file: Can not create file '{0}'".format(self.dbfile))
             
             
         else:
         else:
-            self.loader = mpp.api.Loader()
+            self.loader = api.Loader()
             if self.loader.open_database(self.dbfile) == False:
             if self.loader.open_database(self.dbfile) == False:
                 self.parser.error("option --db-file: Can not open file '{0}'".format(self.dbfile))
                 self.parser.error("option --db-file: Can not open file '{0}'".format(self.dbfile))
-            self.loader_prev = mpp.api.Loader()
+            self.loader_prev = api.Loader()
             if self.dbfile_prev != None:
             if self.dbfile_prev != None:
                 if self.loader_prev.open_database(self.dbfile_prev) == False:
                 if self.loader_prev.open_database(self.dbfile_prev) == False:
                     self.parser.error("option --db-file-prev: Can not open file '{0}'".format(self.dbfile_prev))
                     self.parser.error("option --db-file-prev: Can not open file '{0}'".format(self.dbfile_prev))

mpp/internal/__init__.py → metrixpp/mpp/internal/__init__.py


mpp/internal/api_impl.py → metrixpp/mpp/internal/api_impl.py


mpp/internal/dbwrap.py → metrixpp/mpp/internal/dbwrap.py


+ 38 - 27
mpp/internal/loader.py

@@ -5,7 +5,7 @@
 #    This file is a part of Metrix++ Tool.
 #    This file is a part of Metrix++ Tool.
 #    
 #    
 
 
-import mpp.api
+from metrixpp.mpp import api
 
 
 import os
 import os
 import sys
 import sys
@@ -63,7 +63,32 @@ class Loader(object):
                 self.plugins = []
                 self.plugins = []
                 self.actions = []
                 self.actions = []
                 self.hash    = {}
                 self.hash    = {}
-                
+
+        def load_plugin_config(inicontainer, fname):
+            active_plugins = []
+            config = ConfigParser()
+            config.read(fname)
+            item = {'package': config.get('Plugin', 'package'),
+                    'module': config.get('Plugin', 'module'),
+                    'class': config.get('Plugin', 'class'),
+                    'version': config.get('Plugin', 'version'),
+                    'depends': config.get('Plugin', 'depends'),
+                    'actions': config.get('Plugin', 'actions'),
+                    'enabled': config.getboolean('Plugin', 'enabled'),
+                    'instance': None}
+            if item['enabled']:
+                item['actions'] = item['actions'].split(',')
+                for (ind, action) in enumerate(item['actions']):
+                    action = action.strip()
+                    item['actions'][ind] = action
+                    if action not in inicontainer.actions + ['*', 'None', 'none', 'False', 'false']:
+                        inicontainer.actions.append(action)
+                    if action == '*' or action == command:
+                        active_plugins.append(item['package'] + '.' + item['module'])
+                inicontainer.plugins.append(item)
+                inicontainer.hash[item['package'] + '.' + item['module']] = item
+            return active_plugins
+
         def load_recursively(inicontainer, directory):
         def load_recursively(inicontainer, directory):
             active_plugins = []
             active_plugins = []
             if os.path.exists(directory) == False or os.path.isdir(directory) == False:
             if os.path.exists(directory) == False or os.path.isdir(directory) == False:
@@ -76,27 +101,7 @@ class Loader(object):
                 if os.path.isdir(fname):
                 if os.path.isdir(fname):
                     active_plugins += load_recursively(inicontainer, fname)
                     active_plugins += load_recursively(inicontainer, fname)
                 elif re.match(pattern, fname):
                 elif re.match(pattern, fname):
-                    config = ConfigParser()
-                    config.read(fname)
-                    item = {'package': config.get('Plugin', 'package'),
-                            'module': config.get('Plugin', 'module'),
-                            'class': config.get('Plugin', 'class'),
-                            'version': config.get('Plugin', 'version'),
-                            'depends': config.get('Plugin', 'depends'),
-                            'actions': config.get('Plugin', 'actions'),
-                            'enabled': config.getboolean('Plugin', 'enabled'),
-                            'instance': None}
-                    if item['enabled']:
-                        item['actions'] = item['actions'].split(',')
-                        for (ind, action) in enumerate(item['actions']):
-                            action = action.strip()
-                            item['actions'][ind] = action
-                            if action not in inicontainer.actions + ['*', 'None', 'none', 'False', 'false']:
-                                inicontainer.actions.append(action)
-                            if action == '*' or action == command:
-                                active_plugins.append(item['package'] + '.' + item['module'])
-                        inicontainer.plugins.append(item)
-                        inicontainer.hash[item['package'] + '.' + item['module']] = item
+                    active_plugins += load_plugin_config(inicontainer, fname)
             return active_plugins
             return active_plugins
                         
                         
         def list_dependants_recursively(inicontainer, required_plugin_name):
         def list_dependants_recursively(inicontainer, required_plugin_name):
@@ -123,6 +128,12 @@ class Loader(object):
         required_plugins = []
         required_plugins = []
         for each in ([std_ext_priority_dir, std_ext_dir] + directories):
         for each in ([std_ext_priority_dir, std_ext_dir] + directories):
             required_plugins += load_recursively(inicontainer, each)
             required_plugins += load_recursively(inicontainer, each)
+
+        # append the tests dir if it exists - not on the pypi packet
+        tests_dir = os.path.join(os.environ['METRIXPLUSPLUS_INSTALL_DIR'], 'tests')
+        if os.path.exists(tests_dir):
+            sys.path.append(tests_dir)
+            required_plugins += load_plugin_config(inicontainer, os.path.join(tests_dir, "test.ini"))
         
         
         required_plugins.sort();    # sort the plugin list to get similar results independant of the os
         required_plugins.sort();    # sort the plugin list to get similar results independant of the os
             
             
@@ -171,12 +182,12 @@ class Loader(object):
                   "       python %prog {command} [options] -- [path 1] ... [path N]".format(command=command))
                   "       python %prog {command} [options] -- [path 1] ... [path N]".format(command=command))
 
 
         for item in self.iterate_plugins():
         for item in self.iterate_plugins():
-            if (isinstance(item, mpp.api.IConfigurable)):
+            if (isinstance(item, api.IConfigurable)):
                 item.declare_configuration(optparser)
                 item.declare_configuration(optparser)
 
 
         (options, args) = optparser.parse_args(args)
         (options, args) = optparser.parse_args(args)
         for item in self.iterate_plugins():
         for item in self.iterate_plugins():
-            if (isinstance(item, mpp.api.IConfigurable)):
+            if (isinstance(item, api.IConfigurable)):
                 item.configure(options)
                 item.configure(options)
 
 
         for item in self.iterate_plugins():
         for item in self.iterate_plugins():
@@ -191,7 +202,7 @@ class Loader(object):
     def run(self, args):
     def run(self, args):
         exit_code = 0
         exit_code = 0
         for item in self.iterate_plugins():
         for item in self.iterate_plugins():
-            if (isinstance(item, mpp.api.IRunable)):
+            if (isinstance(item, api.IRunable)):
                 exit_code += item.run(args)
                 exit_code += item.run(args)
         return exit_code
         return exit_code
 
 
@@ -199,7 +210,7 @@ class Loader(object):
         result = object.__repr__(self) + ' with loaded:'
         result = object.__repr__(self) + ' with loaded:'
         for item in self.iterate_plugins():
         for item in self.iterate_plugins():
             result += '\n\t' + item.__repr__()
             result += '\n\t' + item.__repr__()
-            if isinstance(item, mpp.api.Parent):
+            if isinstance(item, api.Parent):
                 result += ' with subscribed:'
                 result += ' with subscribed:'
                 for child in item.iterate_children():
                 for child in item.iterate_children():
                     result += '\n\t\t' + child.__repr__()
                     result += '\n\t\t' + child.__repr__()

mpp/internal/py2txt.py → metrixpp/mpp/internal/py2txt.py


mpp/internal/py2xml.py → metrixpp/mpp/internal/py2xml.py


+ 1 - 1
mpp/log.ini

@@ -7,7 +7,7 @@
 
 
 [Plugin]
 [Plugin]
 version: 1.0
 version: 1.0
-package: mpp
+package: metrixpp.mpp
 module:  log
 module:  log
 class:   Plugin
 class:   Plugin
 depends: None
 depends: None

+ 2 - 2
mpp/log.py

@@ -5,11 +5,11 @@
 #    This file is a part of Metrix++ Tool.
 #    This file is a part of Metrix++ Tool.
 #    
 #    
 
 
-import mpp.api
+from metrixpp.mpp import api
 import logging
 import logging
 import os
 import os
 
 
-class Plugin(mpp.api.BasePlugin, mpp.api.IConfigurable):
+class Plugin(api.BasePlugin, api.IConfigurable):
     
     
     def declare_configuration(self, parser, default_value='INFO'):
     def declare_configuration(self, parser, default_value='INFO'):
         allowed_values = ['DEBUG','INFO','WARNING','ERROR']
         allowed_values = ['DEBUG','INFO','WARNING','ERROR']

+ 4 - 4
mpp/utils.py

@@ -5,8 +5,8 @@
 #    This file is a part of Metrix++ Tool.
 #    This file is a part of Metrix++ Tool.
 #    
 #    
 
 
-import mpp.internal.py2xml
-import mpp.internal.py2txt
+from metrixpp.mpp.internal import py2xml
+from metrixpp.mpp.internal import py2txt
 
 
 import logging
 import logging
 import re
 import re
@@ -98,7 +98,7 @@ def report_bad_path(path):
     logging.error("Specified path '" + path + "' is invalid: not found in the database records.")
     logging.error("Specified path '" + path + "' is invalid: not found in the database records.")
 
 
 def serialize_to_xml(data, root_name = None, digitCount = None):
 def serialize_to_xml(data, root_name = None, digitCount = None):
-    serializer = mpp.internal.py2xml.Py2XML(digitCount)
+    serializer = py2xml.Py2XML(digitCount)
     return serializer.parse(data, objName=root_name)
     return serializer.parse(data, objName=root_name)
 
 
 def serialize_to_python(data, root_name = None):
 def serialize_to_python(data, root_name = None):
@@ -110,5 +110,5 @@ def serialize_to_python(data, root_name = None):
     return prefix + data.__repr__() + postfix
     return prefix + data.__repr__() + postfix
 
 
 def serialize_to_txt(data, root_name = None):
 def serialize_to_txt(data, root_name = None):
-    serializer = mpp.internal.py2txt.Py2TXT()
+    serializer = py2txt.Py2TXT()
     return serializer.parse(data, objName=root_name, indent = -1)
     return serializer.parse(data, objName=root_name, indent = -1)

tests/__init__.py → metrixpp/tests/__init__.py


+ 2 - 2
tests/common.py

@@ -64,7 +64,7 @@ class ToolRunner(object):
             for each in dirs_list:
             for each in dirs_list:
                 self.dirs_list.append(each)
                 self.dirs_list.append(each)
 
 
-        self.call_args = [sys.executable, os.path.join(os.environ['METRIXPLUSPLUS_INSTALL_DIR'], "metrix++.py"), tool_name] \
+        self.call_args = [sys.executable, os.path.join(os.environ['METRIXPLUSPLUS_INSTALL_DIR'], "../metrix++.py"), tool_name] \
                     + db_opts + opts_list + ['--'] + self.dirs_list
                     + db_opts + opts_list + ['--'] + self.dirs_list
         self.cmd = " ".join(self.call_args)
         self.cmd = " ".join(self.call_args)
         self.exit_code_expected = exit_code
         self.exit_code_expected = exit_code
@@ -131,7 +131,7 @@ class ToolRunner(object):
             textDict = text
             textDict = text
             goldDict = gold_text
             goldDict = gold_text
         
         
-        if isinstance(textDict, dict) and isinstance(goldDict, dict):    
+        if isinstance(textDict, dict) and isinstance(goldDict, dict):
             result = (textDict == goldDict)
             result = (textDict == goldDict)
         else:
         else:
             gold_to_compare = gold_text
             gold_to_compare = gold_text

tests/general/test_basic.py → metrixpp/tests/general/test_basic.py


tests/general/test_basic/sources_changed/.unused.cpp → metrixpp/tests/general/test_basic/sources/.unused.cpp


tests/general/test_basic/test_export_format_collect_default_stdout.gold.txt → metrixpp/tests/general/test_basic/sources/dummy.txt


tests/general/test_basic/sources/file_deleted_in_new_sources.cpp → metrixpp/tests/general/test_basic/sources/file_deleted_in_new_sources.cpp


tests/general/test_basic/sources/simple.cpp → metrixpp/tests/general/test_basic/sources/simple.cpp


tests/general/test_basic/test_export_format_collect_nest_stdout.gold.txt → metrixpp/tests/general/test_basic/sources_changed/.unused.cpp


tests/general/test_basic/sources_changed/simple.cpp → metrixpp/tests/general/test_basic/sources_changed/simple.cpp


tests/general/test_basic/sources_changed/simple2.cpp → metrixpp/tests/general/test_basic/sources_changed/simple2.cpp


tests/general/test_basic/test_help_unknown_default_stdout.gold.txt → metrixpp/tests/general/test_basic/test_export_format_collect_default_stdout.gold.txt


tests/general/test_basic/test_std_code_magic_collect_default_stdout.gold.txt → metrixpp/tests/general/test_basic/test_export_format_collect_nest_stdout.gold.txt


tests/general/test_basic/test_export_format_export_nest_per_file_stdout.gold.txt → metrixpp/tests/general/test_basic/test_export_format_export_nest_per_file_stdout.gold.txt


tests/general/test_basic/test_export_format_export_nest_stdout.gold.txt → metrixpp/tests/general/test_basic/test_export_format_export_nest_stdout.gold.txt


tests/general/test_basic/test_export_format_export_python_stdout.gold.txt → metrixpp/tests/general/test_basic/test_export_format_export_python_stdout.gold.txt


tests/general/test_basic/test_export_format_export_txt_stdout.gold.txt → metrixpp/tests/general/test_basic/test_export_format_export_txt_stdout.gold.txt


tests/general/test_basic/test_export_format_export_xml_stdout.gold.txt → metrixpp/tests/general/test_basic/test_export_format_export_xml_stdout.gold.txt


tests/general/test_basic/test_help_--help_default_stdout.gold.txt → metrixpp/tests/general/test_basic/test_help_--help_default_stdout.gold.txt


tests/general/test_basic/test_help_collect_default_stdout.gold.txt → metrixpp/tests/general/test_basic/test_help_collect_default_stdout.gold.txt


tests/general/test_basic/test_help_export_default_stdout.gold.txt → metrixpp/tests/general/test_basic/test_help_export_default_stdout.gold.txt


tests/general/test_basic/test_help_info_default_stdout.gold.txt → metrixpp/tests/general/test_basic/test_help_info_default_stdout.gold.txt


tests/general/test_basic/test_help_limit_default_stdout.gold.txt → metrixpp/tests/general/test_basic/test_help_limit_default_stdout.gold.txt


tests/general/test_basic/test_std_code_magic_collect_nozeros_stdout.gold.txt → metrixpp/tests/general/test_basic/test_help_unknown_default_stdout.gold.txt


tests/general/test_basic/test_help_view_default_stdout.gold.txt → metrixpp/tests/general/test_basic/test_help_view_default_stdout.gold.txt


tests/general/test_basic/test_std_complexity_maxindent_collect_default_stdout.gold.txt → metrixpp/tests/general/test_basic/test_std_code_magic_collect_default_stdout.gold.txt


tests/general/test_basic/test_std_filelines_metrics_collect_default_stdout.gold.txt → metrixpp/tests/general/test_basic/test_std_code_magic_collect_nozeros_stdout.gold.txt


tests/general/test_basic/test_std_code_magic_view_default_stdout.gold.txt → metrixpp/tests/general/test_basic/test_std_code_magic_view_default_stdout.gold.txt


tests/general/test_basic/test_std_code_magic_view_nest_per_file_stdout.gold.txt → metrixpp/tests/general/test_basic/test_std_code_magic_view_nest_per_file_stdout.gold.txt


tests/general/test_basic/test_std_code_magic_view_nozeros_nest_per_file_stdout.gold.txt → metrixpp/tests/general/test_basic/test_std_code_magic_view_nozeros_nest_per_file_stdout.gold.txt


tests/general/test_basic/test_std_code_magic_view_nozeros_stdout.gold.txt → metrixpp/tests/general/test_basic/test_std_code_magic_view_nozeros_stdout.gold.txt


tests/general/test_basic/test_std_general_metrics_collect_default_stdout.gold.txt → metrixpp/tests/general/test_basic/test_std_complexity_maxindent_collect_default_stdout.gold.txt


tests/general/test_basic/test_std_complexity_maxindent_view_default_stdout.gold.txt → metrixpp/tests/general/test_basic/test_std_complexity_maxindent_view_default_stdout.gold.txt


tests/general/test_basic/test_std_complexity_maxindent_view_nest_per_file_stdout.gold.txt → metrixpp/tests/general/test_basic/test_std_complexity_maxindent_view_nest_per_file_stdout.gold.txt


tests/general/test_basic/test_std_lines_metrics_collect_default_stdout.gold.txt → metrixpp/tests/general/test_basic/test_std_filelines_metrics_collect_default_stdout.gold.txt


tests/general/test_basic/test_std_filelines_metrics_view_nest_per_file_stdout.gold.txt → metrixpp/tests/general/test_basic/test_std_filelines_metrics_view_nest_per_file_stdout.gold.txt


tests/general/test_basic/test_std_filelines_metrics_view_txt_stdout.gold.txt → metrixpp/tests/general/test_basic/test_std_filelines_metrics_view_txt_stdout.gold.txt


tests/general/test_basic/test_std_maintindex_collect_default_stdout.gold.txt → metrixpp/tests/general/test_basic/test_std_general_metrics_collect_default_stdout.gold.txt


+ 0 - 0
tests/general/test_basic/test_std_general_metrics_view_nest_per_file_stdout.gold.txt


Some files were not shown because too many files changed in this diff