| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 assert release_version >= min(version_strings.keys()) | 157 assert release_version >= min(version_strings.keys()) |
| 158 return version_strings.get(release_version, 'future') | 158 return version_strings.get(release_version, 'future') |
| 159 | 159 |
| 160 def _determine_linux_version(self, platform_module): | 160 def _determine_linux_version(self, platform_module): |
| 161 # Default to trusty if version is not recognized, this supports third pa
rty integrations. | 161 # Default to trusty if version is not recognized, this supports third pa
rty integrations. |
| 162 version = platform_module.linux_distribution()[2] | 162 version = platform_module.linux_distribution()[2] |
| 163 officially_supported_versions = ['precise', 'trusty'] | 163 officially_supported_versions = ['precise', 'trusty'] |
| 164 return 'trusty' if version not in officially_supported_versions else ver
sion | 164 return 'trusty' if version not in officially_supported_versions else ver
sion |
| 165 | 165 |
| 166 def _determine_win_version(self, win_version_tuple): | 166 def _determine_win_version(self, win_version_tuple): |
| 167 if win_version_tuple[:2] == (10, 0): |
| 168 return '10' |
| 169 if win_version_tuple[:2] == (6, 3): |
| 170 return '8.1' |
| 171 if win_version_tuple[:2] == (6, 2): |
| 172 return '8' |
| 173 if win_version_tuple[:3] == (6, 1, 7601): |
| 174 return '7sp1' |
| 167 if win_version_tuple[:3] == (6, 1, 7600): | 175 if win_version_tuple[:3] == (6, 1, 7600): |
| 168 return '7sp0' | 176 return '7sp0' |
| 169 if win_version_tuple[:2] == (6, 0): | 177 if win_version_tuple[:2] == (6, 0): |
| 170 return 'vista' | 178 return 'vista' |
| 171 if win_version_tuple[:2] == (5, 1): | 179 if win_version_tuple[:2] == (5, 1): |
| 172 return 'xp' | 180 return 'xp' |
| 173 assert win_version_tuple[0] > 6 or win_version_tuple[1] >= 1, 'Unrecogni
zed Windows version tuple: "%s"' % (win_version_tuple,) | 181 assert (win_version_tuple[0] > 10 or |
| 182 win_version_tuple[0] == 10 and win_version_tuple[1] > 0), ( |
| 183 'Unrecognized Windows version tuple: "%s"' % (win_version_tuple,)) |
| 174 return 'future' | 184 return 'future' |
| 175 | 185 |
| 176 def _win_version_tuple(self, sys_module): | 186 def _win_version_tuple(self, sys_module): |
| 177 if hasattr(sys_module, 'getwindowsversion'): | 187 if hasattr(sys_module, 'getwindowsversion'): |
| 178 return sys_module.getwindowsversion() | 188 return sys_module.getwindowsversion() |
| 179 return self._win_version_tuple_from_cmd() | 189 return self._win_version_tuple_from_cmd() |
| 180 | 190 |
| 181 def _win_version_tuple_from_cmd(self): | 191 def _win_version_tuple_from_cmd(self): |
| 182 # Note that this should only ever be called on windows, so this should a
lways work. | 192 # Note that this should only ever be called on windows, so this should a
lways work. |
| 183 ver_output = self._executive.run_command(['cmd', '/c', 'ver'], decode_ou
tput=False) | 193 ver_output = self._executive.run_command(['cmd', '/c', 'ver'], decode_ou
tput=False) |
| 184 match_object = re.search(r'(?P<major>\d+)\.(?P<minor>\d)\.(?P<build>\d+)
', ver_output) | 194 match_object = re.search(r'(?P<major>\d+)\.(?P<minor>\d)\.(?P<build>\d+)
', ver_output) |
| 185 assert match_object, 'cmd returned an unexpected version string: ' + ver
_output | 195 assert match_object, 'cmd returned an unexpected version string: ' + ver
_output |
| 186 return tuple(map(int, match_object.groups())) | 196 return tuple(map(int, match_object.groups())) |
| OLD | NEW |