author | Julien Pagès <j.parkouss@gmail.com> |
Tue, 09 Jun 2015 20:55:07 +0200 | |
changeset 247888 | 43e94edb750b06552493d837619e69dbdb7a2c38 |
parent 247887 | 89fff7bb133efc4cdaea0cdbf605c6c6b78a3780 |
child 247889 | acd94173f7e1cc0cd1f38ea844bccb2f6827e35e |
push id | 28885 |
push user | cbook@mozilla.com |
push date | Wed, 10 Jun 2015 13:18:59 +0000 |
treeherder | autoland@e101c589c242 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | ahal |
bugs | 1060940 |
milestone | 41.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/testing/mozbase/mozrunner/mozrunner/cli.py +++ b/testing/mozbase/mozrunner/mozrunner/cli.py @@ -1,13 +1,12 @@ # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. -import optparse import os import sys from mozprofile import MozProfileCLI from .application import get_app_context from .runners import runners from .utils import findInPath @@ -49,42 +48,31 @@ def debugger_arguments(debugger, argumen class CLI(MozProfileCLI): """Command line interface""" module = "mozrunner" def __init__(self, args=sys.argv[1:]): - self.metadata = getattr(sys.modules[self.module], - 'package_metadata', - {}) - version = self.metadata.get('Version') - parser_args = {'description': self.metadata.get('Summary')} - if version: - parser_args['version'] = "%prog " + version - self.parser = optparse.OptionParser(**parser_args) - self.add_options(self.parser) - (self.options, self.args) = self.parser.parse_args(args) - - if getattr(self.options, 'info', None): - self.print_metadata() - sys.exit(0) + MozProfileCLI.__init__(self, args=args) # choose appropriate runner and profile classes app = self.options.app try: self.runner_class = runners[app] self.profile_class = get_app_context(app).profile_class except KeyError: self.parser.error('Application "%s" unknown (should be one of "%s")' % (app, ', '.join(runners.keys()))) def add_options(self, parser): """add options to the parser""" + parser.description = ("Reliable start/stop/configuration of Mozilla" + " Applications (Firefox, Thunderbird, etc.)") # add profile options MozProfileCLI.add_options(self, parser) # add runner options parser.add_option('-b', "--binary", dest="binary", help="Binary path.", metavar=None, default=None) @@ -96,40 +84,16 @@ class CLI(MozProfileCLI): parser.add_option('--debugger', dest='debugger', help="run under a debugger, e.g. gdb or valgrind") parser.add_option('--debugger-args', dest='debugger_args', action='store', help="arguments to the debugger") parser.add_option('--interactive', dest='interactive', action='store_true', help="run the program interactively") - if self.metadata: - parser.add_option("--info", dest="info", default=False, - action="store_true", - help="Print module information") - - ### methods for introspecting data - - def get_metadata_from_egg(self): - import pkg_resources - ret = {} - dist = pkg_resources.get_distribution(self.module) - if dist.has_metadata("PKG-INFO"): - for line in dist.get_metadata_lines("PKG-INFO"): - key, value = line.split(':', 1) - ret[key] = value - if dist.has_metadata("requires.txt"): - ret["Dependencies"] = "\n" + dist.get_metadata("requires.txt") - return ret - - def print_metadata(self, data=("Name", "Version", "Summary", "Home-page", - "Author", "Author-email", "License", "Platform", "Dependencies")): - for key in data: - if key in self.metadata: - print key + ": " + self.metadata[key] ### methods for running def command_args(self): """additional arguments for the mozilla application""" return map(os.path.expanduser, self.options.appArgs) def runner_args(self):