view.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #
  2. # Metrix++, Copyright 2009-2013, Metrix++ Project
  3. # Link: http://metrixplusplus.sourceforge.net
  4. #
  5. # This file is a part of Metrix++ Tool.
  6. #
  7. # Metrix++ is free software: you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation, version 3 of the License.
  10. #
  11. # Metrix++ is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with Metrix++. If not, see <http://www.gnu.org/licenses/>.
  18. #
  19. import os
  20. import mpp.internal.loader
  21. import mpp.api
  22. class Tool(mpp.api.ITool):
  23. def run(self, tool_args):
  24. return main(tool_args)
  25. def main(tool_args):
  26. loader = mpp.internal.loader.Loader()
  27. mpp_paths = []
  28. # TODO document this feature
  29. if 'METRIXPLUSPLUS_PATH' in os.environ.keys():
  30. mpp_paths = os.environ['METRIXPLUSPLUS_PATH'].split(os.pathsep)
  31. args = loader.load('view', mpp_paths, tool_args)
  32. exit_code = loader.run(args)
  33. loader.unload()
  34. return exit_code