Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / tools / site_compare / scrapers / chrome / __init__.py
blob587a50db735d759a0806c2836734eea403dd5882
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 Chrome."""
9 def GetScraper(version):
10 """Returns the scraper module for the given version.
12 Args:
13 version: version string of Chrome, or None for most recent
15 Returns:
16 scrape module for given version
17 """
18 if version is None:
19 version = "0.1.101.0"
21 parsed_version = [int(x) for x in version.split(".")]
23 if (parsed_version[0] > 0 or
24 parsed_version[1] > 1 or
25 parsed_version[2] > 97 or
26 parsed_version[3] > 0):
27 scraper_version = "chrome011010"
28 else:
29 scraper_version = "chrome01970"
31 return __import__(scraper_version, globals(), locals(), [''])
34 # if invoked rather than imported, test
35 if __name__ == "__main__":
36 print GetScraper("0.1.101.0").version