1. Atlassian
  2. Project: Atlassian
  3. bamboo-gcov-plugin

Commits

Matt Clarkson  committed 7286cb1

Added a main routine
Updated Readme with usage information

  • Participants
  • Parent commits 5570567
  • Branches default

Comments (0)

Files changed (2)

File README.md

View file
 Atlassian host a
 [documentation page](https://confluence.atlassian.com/x/ZYCyEQ) on their
 Confluence Wiki.
+
+Usage
+-----
+
+The python file is executable and has full usage documentation.  Run the
+following command to see the documentation:
+
+`./gcov_to_clover -h`

File gcov_to_clover.py

View file
 '''
 A module that converts gcov output files into Atlassian clover XML files.
 
-This is open-sourced at:
+It is open-sourced at:
 https://bitbucket.org/atlassian/bamboo-gcov-plugin/
 '''
 
         :param package_name: the package this file belongs to (default: "Unknown")
         :type package_name: string
         '''
-        if not os.path.isabs(file_path):
-            raise ValueError('Must use a list of absolute paths')
+        file_path = os.path.normpath(os.path.abspath(file_path))
 
         # Get the nodes we need for this file
         coverage_node = self.get_coverage_node()
         :param file_paths: a list of filesystem absolute paths
         :type file_paths: list of strings
         '''
-        if not isinstance(list, file_paths):
+        if not isinstance(file_paths, list):
             file_paths = [file_paths]
         for file_path in file_paths:
             self.parse_file(file_path)
         '''
         self.parse(files)
         self.write(output_path)
+
+# Executable stuff
+if __name__ == '__main__':
+    import argparse
+
+    def main():
+        parser = argparse.ArgumentParser(description = __doc__,
+            epilog = 'example: %s example.cpp.gcov')
+        default = 'clover.xml'
+        parser.add_argument('-o, --output', dest = 'output', default = default,
+            help = 'the file path to output the Atlassian Clover XML (%s)' % default)
+        parser.add_argument('file_paths', metavar='file_path',
+            type=str, nargs='+', help='file paths to gcov output files (.gcov)')
+        args = parser.parse_args()
+        gtc = gcov_to_clover()
+        gtc.process(args.file_paths, args.output)
+
+    main()