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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 return self._is_cygwin | 68 return self._is_cygwin |
69 | 69 |
70 def is_linux(self): | 70 def is_linux(self): |
71 return self.os_name == 'linux' | 71 return self.os_name == 'linux' |
72 | 72 |
73 def is_freebsd(self): | 73 def is_freebsd(self): |
74 return self.os_name == 'freebsd' | 74 return self.os_name == 'freebsd' |
75 | 75 |
76 def is_highdpi(self): | 76 def is_highdpi(self): |
77 if self.is_mac(): | 77 if self.is_mac(): |
78 output = self._executive.run_command(['system_profiler', 'SPDisplays
DataType'], error_handler=self._executive.ignore_error) | 78 output = self._executive.run_command(['system_profiler', 'SPDisplays
DataType'], |
| 79 error_handler=self._executive.i
gnore_error) |
79 if output and 'Retina: Yes' in output: | 80 if output and 'Retina: Yes' in output: |
80 return True | 81 return True |
81 return False | 82 return False |
82 | 83 |
83 def display_name(self): | 84 def display_name(self): |
84 # platform.platform() returns Darwin information for Mac, which is just
confusing. | 85 # platform.platform() returns Darwin information for Mac, which is just
confusing. |
85 if self.is_mac(): | 86 if self.is_mac(): |
86 return "Mac OS X %s" % self._platform_module.mac_ver()[0] | 87 return "Mac OS X %s" % self._platform_module.mac_ver()[0] |
87 | 88 |
88 # Returns strings like: | 89 # Returns strings like: |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 if hasattr(sys_module, 'getwindowsversion'): | 183 if hasattr(sys_module, 'getwindowsversion'): |
183 return sys_module.getwindowsversion() | 184 return sys_module.getwindowsversion() |
184 return self._win_version_tuple_from_cmd() | 185 return self._win_version_tuple_from_cmd() |
185 | 186 |
186 def _win_version_tuple_from_cmd(self): | 187 def _win_version_tuple_from_cmd(self): |
187 # Note that this should only ever be called on windows, so this should a
lways work. | 188 # Note that this should only ever be called on windows, so this should a
lways work. |
188 ver_output = self._executive.run_command(['cmd', '/c', 'ver'], decode_ou
tput=False) | 189 ver_output = self._executive.run_command(['cmd', '/c', 'ver'], decode_ou
tput=False) |
189 match_object = re.search(r'(?P<major>\d+)\.(?P<minor>\d)\.(?P<build>\d+)
', ver_output) | 190 match_object = re.search(r'(?P<major>\d+)\.(?P<minor>\d)\.(?P<build>\d+)
', ver_output) |
190 assert match_object, 'cmd returned an unexpected version string: ' + ver
_output | 191 assert match_object, 'cmd returned an unexpected version string: ' + ver
_output |
191 return tuple(map(int, match_object.groups())) | 192 return tuple(map(int, match_object.groups())) |
OLD | NEW |