Build SkThreadUtils (home of SkThread type) too.
[chromium-blink-merge.git] / tools / site_compare / scrapers / __init__.py
blob5f6d77885b7251eb6cdedad19b6740aa11e819df
1 #!/usr/bin/env python
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
6 """Selects the appropriate scraper for a given browser and version."""
8 import types
10 # TODO(jhaas): unify all optional scraper parameters into kwargs
12 def GetScraper(browser):
13 """Given a browser and an optional version, returns the scraper module.
15 Args:
16 browser: either a string (browser name) or a tuple (name, version)
18 Returns:
19 module
20 """
22 if type(browser) == types.StringType: browser = (browser, None)
24 package = __import__(browser[0], globals(), locals(), [''])
25 module = package.GetScraper(browser[1])
26 if browser[1] is not None: module.version = browser[1]
28 return module
31 # if invoked rather than imported, do some tests
32 if __name__ == "__main__":
33 print GetScraper("IE")