| OLD | NEW |
| 1 # Copyright (c) 2011 Google Inc. All rights reserved. | 1 # Copyright (c) 2011 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 raise AssertionError('unrecognized platform string "%s"' % sys_platform) | 146 raise AssertionError('unrecognized platform string "%s"' % sys_platform) |
| 147 | 147 |
| 148 def _determine_mac_version(self, mac_version_string): | 148 def _determine_mac_version(self, mac_version_string): |
| 149 minor_release = int(mac_version_string.split('.')[1]) | 149 minor_release = int(mac_version_string.split('.')[1]) |
| 150 # FIXME: This should really be >= 9, and we should get rid of 'future'. | 150 # FIXME: This should really be >= 9, and we should get rid of 'future'. |
| 151 assert minor_release >= 6, 'Unsupported mac os version: %s' % mac_versio
n_string | 151 assert minor_release >= 6, 'Unsupported mac os version: %s' % mac_versio
n_string |
| 152 if minor_release in (9, 10, 11): | 152 if minor_release in (9, 10, 11): |
| 153 return 'mac10.%d' % minor_release | 153 return 'mac10.%d' % minor_release |
| 154 return 'future' | 154 return 'future' |
| 155 | 155 |
| 156 def _determine_linux_version(self, platform_module): | 156 def _determine_linux_version(self, _): |
| 157 # Default to trusty if version is not recognized, this supports third pa
rty integrations. | 157 return 'trusty' |
| 158 version = platform_module.linux_distribution()[2] | |
| 159 officially_supported_versions = ['precise', 'trusty'] | |
| 160 return 'trusty' if version not in officially_supported_versions else ver
sion | |
| 161 | 158 |
| 162 def _determine_win_version(self, win_version_tuple): | 159 def _determine_win_version(self, win_version_tuple): |
| 163 if win_version_tuple[:2] == (10, 0): | 160 if win_version_tuple[:2] == (10, 0): |
| 164 return '10' | 161 return '10' |
| 165 if win_version_tuple[:2] == (6, 3): | 162 if win_version_tuple[:2] == (6, 3): |
| 166 return '8.1' | 163 return '8.1' |
| 167 if win_version_tuple[:2] == (6, 2): | 164 if win_version_tuple[:2] == (6, 2): |
| 168 return '8' | 165 return '8' |
| 169 if win_version_tuple[:3] == (6, 1, 7601): | 166 if win_version_tuple[:3] == (6, 1, 7601): |
| 170 return '7sp1' | 167 return '7sp1' |
| (...skipping 12 matching lines...) Expand all Loading... |
| 183 if hasattr(sys_module, 'getwindowsversion'): | 180 if hasattr(sys_module, 'getwindowsversion'): |
| 184 return sys_module.getwindowsversion() | 181 return sys_module.getwindowsversion() |
| 185 return self._win_version_tuple_from_cmd() | 182 return self._win_version_tuple_from_cmd() |
| 186 | 183 |
| 187 def _win_version_tuple_from_cmd(self): | 184 def _win_version_tuple_from_cmd(self): |
| 188 # Note that this should only ever be called on windows, so this should a
lways work. | 185 # Note that this should only ever be called on windows, so this should a
lways work. |
| 189 ver_output = self._executive.run_command(['cmd', '/c', 'ver'], decode_ou
tput=False) | 186 ver_output = self._executive.run_command(['cmd', '/c', 'ver'], decode_ou
tput=False) |
| 190 match_object = re.search(r'(?P<major>\d+)\.(?P<minor>\d)\.(?P<build>\d+)
', ver_output) | 187 match_object = re.search(r'(?P<major>\d+)\.(?P<minor>\d)\.(?P<build>\d+)
', ver_output) |
| 191 assert match_object, 'cmd returned an unexpected version string: ' + ver
_output | 188 assert match_object, 'cmd returned an unexpected version string: ' + ver
_output |
| 192 return tuple(map(int, match_object.groups())) | 189 return tuple(map(int, match_object.groups())) |
| OLD | NEW |