diff options
author | Dylan Baker <baker.dylan.c@gmail.com> | 2014-05-02 00:23:28 -0700 |
---|---|---|
committer | Dylan Baker <baker.dylan.c@gmail.com> | 2014-05-06 20:10:22 -0700 |
commit | 9b1e7da290cd612690e85bcacc99b50c65d83fe6 (patch) | |
tree | 2368cf51b5639a666245636b50d42dde5bf7fd24 /piglit-summary-html.py | |
parent | 463b049bf3b0a9cc41bc4886d013f161b8156e74 (diff) |
framework: move executable functions to modules
This moves piglit-run and piglit-resume main() functions to
framework.programs.run as run() and resume() respectively, and moves
piglit-summary-* to framework.programs.summary. It then creates
compatibility wrappers as piglit-*.py for the functions.
This is groundwork for a combined piglit interface. The original files
could not be imported directly since they have dash (-) in their name,
and python considers dash an illegal character for function, class, and
modules names, and python would raise an ImportError when attempting to
import one of them.
Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Diffstat (limited to 'piglit-summary-html.py')
-rwxr-xr-x | piglit-summary-html.py | 113 |
1 files changed, 20 insertions, 93 deletions
diff --git a/piglit-summary-html.py b/piglit-summary-html.py index 58b6823a4..92a350d0d 100755 --- a/piglit-summary-html.py +++ b/piglit-summary-html.py @@ -1,101 +1,28 @@ #!/usr/bin/env python -# -# Permission is hereby granted, free of charge, to any person -# obtaining a copy of this software and associated documentation -# files (the "Software"), to deal in the Software without -# restriction, including without limitation the rights to use, -# copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following -# conditions: -# -# This permission notice shall be included in all copies or -# substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -# PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR(S) BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. -import argparse -import sys -import shutil -import os.path as path - -import framework.summary as summary -import framework.status as status -from framework.core import checkDir, parse_listfile - -sys.path.append(path.dirname(path.realpath(sys.argv[0]))) - - -def main(): - # Make a copy of the status text list and add all. This is used as the - # argument list for -e/--exclude - statuses = set(str(s) for s in status.ALL) - statuses.add('all') +# Copyright (c) 2014 Intel Corporation - parser = argparse.ArgumentParser() - parser.add_argument("-o", "--overwrite", - action="store_true", - help="Overwrite existing directories") - parser.add_argument("-l", "--list", - action="store", - help="Load a newline seperated list of results. These " - "results will be prepended to any Results " - "specified on the command line") - parser.add_argument("-e", "--exclude-details", - default=[], - action="append", - choices=statuses, - help="Optionally exclude the generation of HTML pages " - "for individual test pages with the status(es) " - "given as arguments. This speeds up HTML " - "generation, but reduces the info in the HTML " - "pages. May be used multiple times") - parser.add_argument("summaryDir", - metavar="<Summary Directory>", - help="Directory to put HTML files in") - parser.add_argument("resultsFiles", - metavar="<Results Files>", - nargs="*", - help="Results files to include in HTML") - args = parser.parse_args() +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: - # If args.list and args.resultsFiles are empty, then raise an error - if not args.list and not args.resultsFiles: - raise parser.error("Missing required option -l or <resultsFiles>") +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. - # Convert the exclude_details list to status objects, without this using - # the -e option will except - if args.exclude_details: - # If exclude-results has all, then change it to be all - if 'all' in args.exclude_details: - args.exclude_details = status.ALL - else: - args.exclude_details = frozenset( - status.status_lookup(i) for i in args.exclude_details) +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +""" Deprecated compatability wrapper for html summary """ - # if overwrite is requested delete the output directory - if path.exists(args.summaryDir) and args.overwrite: - shutil.rmtree(args.summaryDir) - - # If the requested directory doesn't exist, create it or throw an error - checkDir(args.summaryDir, not args.overwrite) - - # Merge args.list and args.resultsFiles - if args.list: - args.resultsFiles.extend(parse_listfile(args.list)) - - # Create the HTML output - output = summary.Summary(args.resultsFiles) - output.generate_html(args.summaryDir, args.exclude_details) - +import sys +from framework.programs.summary import html -if __name__ == "__main__": - main() +html(sys.argv) |