| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 | 2 |
| 3 import requests | 3 import requests |
| 4 import re | 4 import re |
| 5 from in_file import InFile | 5 from in_file import InFile |
| 6 | 6 |
| 7 BRANCH_FORMAT = "https://src.chromium.org/blink/branches/chromium/%s/%s" | 7 BRANCH_FORMAT = "https://src.chromium.org/blink/branches/chromium/%s/%s" |
| 8 TRUNK_PATH = "Source/platform/RuntimeEnabledFeatures.in" | 8 TRUNK_PATH = "Source/platform/RuntimeEnabledFeatures.in" |
| 9 TRUNK_URL = "https://src.chromium.org/blink/trunk/%s" % TRUNK_PATH | 9 TRUNK_URL = "https://src.chromium.org/blink/trunk/%s" % TRUNK_PATH |
| 10 | 10 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 | 41 |
| 42 def stable_features(in_file): | 42 def stable_features(in_file): |
| 43 return [feature['name'] for feature in in_file.name_dictionaries if feature[
'status'] == 'stable'] | 43 return [feature['name'] for feature in in_file.name_dictionaries if feature[
'status'] == 'stable'] |
| 44 | 44 |
| 45 | 45 |
| 46 def branch_from_version(version_string): | 46 def branch_from_version(version_string): |
| 47 # Format: 31.0.1650.63, the second digit was only ever used for M4 | 47 # Format: 31.0.1650.63, the second digit was only ever used for M4 |
| 48 # no clue what it's actually intended for. | 48 # no clue what it's actually intended for. |
| 49 version_regexp = r"(?P<major>\d+)\.\d+\.(?P<branch>\d+)\.(?P<minor>\d+)" | 49 version_regexp = r"(?P<major>\d+)\.\d+\.(?P<branch>\d+)\.(?P<minor>\d+)" |
| 50 return int(re.match(version_regexp, version_string).group('branch')) | 50 match = re.match(version_regexp, version_string) |
| 51 # if match == None, we'll blow up, so at least provide some debugging inform
ation: |
| 52 if not match: |
| 53 print version_string |
| 54 return int(match.group('branch')) |
| 51 | 55 |
| 52 | 56 |
| 53 def print_feature_diff(added_features, removed_features): | 57 def print_feature_diff(added_features, removed_features): |
| 54 for feature in added_features: | 58 for feature in added_features: |
| 55 print "+ %s" % feature | 59 print "+ %s" % feature |
| 56 for feature in removed_features: | 60 for feature in removed_features: |
| 57 print "- %s" % feature | 61 print "- %s" % feature |
| 58 | 62 |
| 59 | 63 |
| 60 def historical_versions(os_string, channel): | 64 def historical_versions(os_string, channel): |
| 61 url_pattern = "http://omahaproxy.appspot.com/history?os=%s&channel=%s" | 65 url_pattern = "http://omahaproxy.appspot.com/history?os=%s&channel=%s" |
| 62 url = url_pattern % (os_string, channel) | 66 url = url_pattern % (os_string, channel) |
| 63 releases_csv = requests.get(url).text.strip("\n") | 67 releases_csv = requests.get(url).text.strip("\n") |
| 64 # Format: os,channel,version_string,date_string | 68 # Format: os,channel,version_string,date_string |
| 65 return [line.split(',')[2] for line in releases_csv.split("\n")] | 69 lines = releases_csv.split('\n') |
| 70 # As of June 2014, omahaproxy is now including headers: |
| 71 assert(lines[0] == 'os,channel,version,timestamp') |
| 72 # FIXME: We could replace this with more generic CSV parsing now that we hav
e headers. |
| 73 return [line.split(',')[2] for line in lines[1:]] |
| 66 | 74 |
| 67 | 75 |
| 68 def feature_file_url_for_branch(branch): | 76 def feature_file_url_for_branch(branch): |
| 69 path = features_path(branch) | 77 path = features_path(branch) |
| 70 if not path: | 78 if not path: |
| 71 return None | 79 return None |
| 72 return BRANCH_FORMAT % (branch, path) | 80 return BRANCH_FORMAT % (branch, path) |
| 73 | 81 |
| 74 | 82 |
| 75 def feature_file_for_branch(branch): | 83 def feature_file_for_branch(branch): |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 for version, feature_file in historical_tuples + active_tuples: | 167 for version, feature_file in historical_tuples + active_tuples: |
| 160 auditor.add_version(version, feature_file) | 168 auditor.add_version(version, feature_file) |
| 161 | 169 |
| 162 print "\nConsider for removal (have been stable for at least one release):" | 170 print "\nConsider for removal (have been stable for at least one release):" |
| 163 for feature in stale_features(historical_tuples): | 171 for feature in stale_features(historical_tuples): |
| 164 print feature | 172 print feature |
| 165 | 173 |
| 166 | 174 |
| 167 if __name__ == "__main__": | 175 if __name__ == "__main__": |
| 168 main() | 176 main() |
| OLD | NEW |