| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 if sys_platform.startswith('linux'): | 140 if sys_platform.startswith('linux'): |
| 141 return 'linux' | 141 return 'linux' |
| 142 if sys_platform in ('win32', 'cygwin'): | 142 if sys_platform in ('win32', 'cygwin'): |
| 143 return 'win' | 143 return 'win' |
| 144 if sys_platform.startswith('freebsd'): | 144 if sys_platform.startswith('freebsd'): |
| 145 return 'freebsd' | 145 return 'freebsd' |
| 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 assert minor_release >= 9, 'Unsupported mac OS version: %s' % mac_versio
n_string |
| 151 assert minor_release >= 6, 'Unsupported mac os version: %s' % mac_versio
n_string | 151 if minor_release <= 12: |
| 152 if minor_release in (9, 10, 11): | |
| 153 return 'mac10.%d' % minor_release | 152 return 'mac10.%d' % minor_release |
| 154 return 'future' | 153 return 'future' |
| 155 | 154 |
| 156 def _determine_linux_version(self, _): | 155 def _determine_linux_version(self, _): |
| 157 return 'trusty' | 156 return 'trusty' |
| 158 | 157 |
| 159 def _determine_win_version(self, win_version_tuple): | 158 def _determine_win_version(self, win_version_tuple): |
| 160 if win_version_tuple[:2] == (10, 0): | 159 if win_version_tuple[:2] == (10, 0): |
| 161 return '10' | 160 return '10' |
| 162 if win_version_tuple[:2] == (6, 3): | 161 if win_version_tuple[:2] == (6, 3): |
| (...skipping 18 matching lines...) Expand all Loading... |
| 181 if hasattr(sys_module, 'getwindowsversion'): | 180 if hasattr(sys_module, 'getwindowsversion'): |
| 182 return sys_module.getwindowsversion() | 181 return sys_module.getwindowsversion() |
| 183 return self._win_version_tuple_from_cmd() | 182 return self._win_version_tuple_from_cmd() |
| 184 | 183 |
| 185 def _win_version_tuple_from_cmd(self): | 184 def _win_version_tuple_from_cmd(self): |
| 186 # 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. |
| 187 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) |
| 188 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) |
| 189 assert match_object, 'cmd returned an unexpected version string: ' + ver
_output | 188 assert match_object, 'cmd returned an unexpected version string: ' + ver
_output |
| 190 return tuple(map(int, match_object.groups())) | 189 return tuple(map(int, match_object.groups())) |
| OLD | NEW |