collect.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 logging
  20. import os.path
  21. import core.loader
  22. import core.cmdparser
  23. import core.api
  24. class Tool(core.api.ITool):
  25. def run(self, tool_args):
  26. return main(tool_args)
  27. def main(tool_args):
  28. loader = core.loader.Loader()
  29. parser =core.cmdparser.MultiOptionParser(usage="Usage: %prog collect [options] -- [path 1] ... [path N]")
  30. args = loader.load(os.path.join(os.environ['METRIXPLUSPLUS_INSTALL_DIR'], 'ext'), parser, tool_args)
  31. logging.debug("Registered plugins:")
  32. logging.debug(loader)
  33. exit_code = loader.run(args)
  34. loader.unload()
  35. return exit_code