1# Copyright (c) 2013 The Chromium Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4""" 5A library for cross-platform browser tests. 6""" 7import inspect 8import os 9import sys 10 11from telemetry.core.browser import Browser 12from telemetry.core.browser_options import BrowserOptions 13from telemetry.core.tab import Tab 14 15from telemetry.page.page_measurement import PageMeasurement 16from telemetry.page.page_runner import Run as RunPage 17 18__all__ = [] 19 20# Find all local vars that are classes or functions and make sure they're in the 21# __all__ array so they're included in docs. 22for x in dir(): 23 if x.startswith('_'): 24 continue 25 if x in (inspect, sys): 26 continue 27 m = sys.modules[__name__] 28 if (inspect.isclass(getattr(m, x)) or 29 inspect.isfunction(getattr(m, x))): 30 __all__.append(x) 31 32 33def _RemoveAllStalePycFiles(): 34 for dirname, _, filenames in os.walk(os.path.dirname(__file__)): 35 if '.svn' in dirname or '.git' in dirname: 36 continue 37 for filename in filenames: 38 root, ext = os.path.splitext(filename) 39 if ext != '.pyc': 40 continue 41 42 pyc_path = os.path.join(dirname, filename) 43 py_path = os.path.join(dirname, root + '.py') 44 if not os.path.exists(py_path): 45 os.remove(pyc_path) 46 47 if not os.listdir(dirname): 48 os.removedirs(dirname) 49 50 51_RemoveAllStalePycFiles() 52