| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import sys | 5 import sys |
| 6 import platform | 6 import platform |
| 7 | 7 |
| 8 from slave import recipe_api | 8 from slave import recipe_api |
| 9 | 9 |
| 10 | 10 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 self._bits = norm_bits(self._test_data.get('bits', 64)) | 46 self._bits = norm_bits(self._test_data.get('bits', 64)) |
| 47 else: # pragma: no cover | 47 else: # pragma: no cover |
| 48 # platform.machine is based on running kernel. It's possible to use 64-bit | 48 # platform.machine is based on running kernel. It's possible to use 64-bit |
| 49 # kernel with 32-bit userland, e.g. to give linker slightly more memory. | 49 # kernel with 32-bit userland, e.g. to give linker slightly more memory. |
| 50 # Distinguish between different userland bitness by querying | 50 # Distinguish between different userland bitness by querying |
| 51 # the python binary. | 51 # the python binary. |
| 52 if (self._name == 'linux' and | 52 if (self._name == 'linux' and |
| 53 self._bits == 64 and | 53 self._bits == 64 and |
| 54 platform.architecture()[0] == '32bit'): | 54 platform.architecture()[0] == '32bit'): |
| 55 self._bits = 32 | 55 self._bits = 32 |
| 56 # On Mac, the inverse of the above is true: the kernel is 32-bit but the |
| 57 # CPU and userspace both are capable of running 64-bit programs. |
| 58 elif (self._name == 'mac' and |
| 59 self._bits == 32 and |
| 60 platform.architecture()[0] == '64bit'): |
| 61 self._bits = 64 |
| 56 | 62 |
| 57 @property | 63 @property |
| 58 @recipe_api.non_step | 64 @recipe_api.non_step |
| 59 def is_win(self): | 65 def is_win(self): |
| 60 return self.name == 'win' | 66 return self.name == 'win' |
| 61 | 67 |
| 62 @property | 68 @property |
| 63 @recipe_api.non_step | 69 @recipe_api.non_step |
| 64 def is_mac(self): | 70 def is_mac(self): |
| 65 return self.name == 'mac' | 71 return self.name == 'mac' |
| (...skipping 18 matching lines...) Expand all Loading... |
| 84 @property | 90 @property |
| 85 @recipe_api.non_step | 91 @recipe_api.non_step |
| 86 def arch(self): | 92 def arch(self): |
| 87 return self._arch | 93 return self._arch |
| 88 | 94 |
| 89 @staticmethod | 95 @staticmethod |
| 90 @recipe_api.non_step | 96 @recipe_api.non_step |
| 91 def normalize_platform_name(platform): | 97 def normalize_platform_name(platform): |
| 92 """One of python's sys.platform values -> 'win', 'linux' or 'mac'.""" | 98 """One of python's sys.platform values -> 'win', 'linux' or 'mac'.""" |
| 93 return norm_plat(platform) # pragma: no cover | 99 return norm_plat(platform) # pragma: no cover |
| OLD | NEW |