aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <baker.dylan.c@gmail.com>2013-03-20 14:30:25 -0700
committerKenneth Graunke <kenneth@whitecape.org>2013-04-21 14:42:27 -0700
commit7c718a322c8fab02feaf79cd0ece51042abadb63 (patch)
treeac75c61f8a21d66d46972d889eb8ef8d3819f172
parent4bf769e85cf5d8ba2367ab71e9fc3e8a71a479b3 (diff)
downloadpiglit-7c718a322c8fab02feaf79cd0ece51042abadb63.tar.gz
piglit-merge-results.py: Convert from getopt to argparse
Creates a smaller, simpler file that should be easier to maintain going forward. Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
-rwxr-xr-xpiglit-merge-results.py39
1 files changed, 9 insertions, 30 deletions
diff --git a/piglit-merge-results.py b/piglit-merge-results.py
index 50430e76..79faf27f 100755
--- a/piglit-merge-results.py
+++ b/piglit-merge-results.py
@@ -22,7 +22,7 @@
# DEALINGS IN THE SOFTWARE.
-from getopt import getopt, GetoptError
+import argparse
import sys, os.path
sys.path.append(os.path.dirname(os.path.realpath(sys.argv[0])))
@@ -33,38 +33,17 @@ import framework.core as core
#############################################################################
##### Main program
#############################################################################
-def usage():
- USAGE = """\
-Usage: %(progName)s [options] [main results file]
-
-Options:
- -h, --help Show this message
-
-Example:
- %(progName)s results/main > results/summary
-"""
- print USAGE % {'progName': sys.argv[0]}
- sys.exit(1)
-
def main():
- try:
- options, args = getopt(sys.argv[1:], "h", [ "help" ])
- except GetoptError:
- usage()
-
- OptionName = ''
-
- for name, value in options:
- if name in ('-h', '--help'):
- usage()
-
- if len(args) < 2:
- usage()
+ parser = argparse.ArgumentParser()
+ parser.add_argument("results",
+ metavar = "<First Results File>",
+ nargs = "*",
+ help = "Space seperated list of results files")
+ args = parser.parse_args()
- combined = core.loadTestResults(args[0])
- del args[0]
+ combined = core.loadTestResults(args.results.pop(0))
- for resultsDir in args:
+ for resultsDir in args.results:
results = core.loadTestResults(resultsDir)
for testname, result in results.tests.items():