OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 import os | 5 import os |
6 import sys | 6 import sys |
7 | 7 |
8 # Attempt to work around bug in GLib by getting DBus session bus | |
dtu
2013/10/25 01:42:32
nit: put the entire thing in a function and call i
| |
9 # address early. crbug.com/309093 | |
10 import platform | |
11 import re | |
12 import subprocess | |
13 if (platform.uname()[0].lower() == 'linux' and | |
14 'DBUS_SESSION_BUS_ADDRESS' not in os.environ): | |
15 try: | |
16 dbus_output = subprocess.check_output(['dbus-launch']).split('\n') | |
17 for line in dbus_output: | |
18 m = re.match(r"([^=]+)\=(.+)", line) | |
19 if m: | |
20 os.environ[m.group(1)] = m.group(2) | |
21 except: | |
22 pass | |
23 | |
8 sys.path.append(os.path.join(os.path.dirname(__file__), | 24 sys.path.append(os.path.join(os.path.dirname(__file__), |
9 os.pardir, os.pardir, os.pardir, 'tools', 'telemetry')) | 25 os.pardir, os.pardir, os.pardir, 'tools', 'telemetry')) |
10 | 26 |
11 from telemetry import test_runner | 27 from telemetry import test_runner |
12 | 28 |
13 if __name__ == '__main__': | 29 if __name__ == '__main__': |
14 sys.exit(test_runner.Main()) | 30 sys.exit(test_runner.Main()) |
OLD | NEW |