no bug - Bumping Firefox l10n changesets r=release a=l10n-bump DONTBUILD CLOSED TREE
[gecko.git] / python / mozperftest / mozperftest / metadata.py
blob95864e14e28125d54023faf89348673d0554e949
1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
4 from collections import defaultdict
6 from mozperftest.utils import MachLogger
9 class Metadata(MachLogger):
10 def __init__(self, mach_cmd, env, flavor, script):
11 MachLogger.__init__(self, mach_cmd)
12 self._mach_cmd = mach_cmd
13 self.flavor = flavor
14 self.options = defaultdict(dict)
15 self._results = []
16 self._output = None
17 self._env = env
18 self.script = script
20 def run_hook(self, name, *args, **kw):
21 # this bypasses layer restrictions on args,
22 # which is fine since it's a user script
23 return self._env.hooks.run(name, *args, **kw)
25 def set_output(self, output):
26 self._output = output
28 def get_output(self):
29 return self._output
31 def add_result(self, result):
32 self._results.append(result)
34 def get_results(self):
35 return self._results
37 def clear_results(self):
38 self._results = []
40 def update_options(self, name, options):
41 self.options[name].update(options)
43 def get_options(self, name):
44 return self.options[name]