| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 """Utility functions used by the bisect tool. | 5 """Utility functions used by the bisect tool. |
| 6 | 6 |
| 7 This includes functions related to checking out the depot and outputting | 7 This includes functions related to checking out the depot and outputting |
| 8 annotations for the Buildbot waterfall. | 8 annotations for the Buildbot waterfall. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 True if the string can be converted to a float. | 534 True if the string can be converted to a float. |
| 535 """ | 535 """ |
| 536 try: | 536 try: |
| 537 float(string_to_check) | 537 float(string_to_check) |
| 538 return True | 538 return True |
| 539 except ValueError: | 539 except ValueError: |
| 540 return False | 540 return False |
| 541 | 541 |
| 542 | 542 |
| 543 def IsWindowsHost(): | 543 def IsWindowsHost(): |
| 544 """Checks whether or not the script is running on Windows. | 544 """Checks whether or not the script is running on Windows.""" |
| 545 | |
| 546 Returns: | |
| 547 True if running on Windows. | |
| 548 """ | |
| 549 return sys.platform == 'cygwin' or sys.platform.startswith('win') | 545 return sys.platform == 'cygwin' or sys.platform.startswith('win') |
| 550 | 546 |
| 551 | 547 |
| 552 def Is64BitWindows(): | 548 def Is64BitWindows(): |
| 553 """Returns whether or not Windows is a 64-bit version. | 549 """Returns whether or not Windows is a 64-bit version. |
| 554 | 550 |
| 555 Returns: | 551 Returns: |
| 556 True if Windows is 64-bit, False if 32-bit. | 552 True if Windows is 64-bit, False if 32-bit. |
| 557 """ | 553 """ |
| 558 platform = os.environ['PROCESSOR_ARCHITECTURE'] | 554 platform = os.environ.get('PROCESSOR_ARCHITEW6432') |
| 559 try: | 555 if not platform: |
| 560 platform = os.environ['PROCESSOR_ARCHITEW6432'] | 556 # Must not be running in WoW64, so PROCESSOR_ARCHITECTURE is correct. |
| 561 except KeyError: | 557 platform = os.environ.get('PROCESSOR_ARCHITECTURE') |
| 562 # Must not be running in WoW64, so PROCESSOR_ARCHITECTURE is correct | 558 return platform and platform in ['AMD64', 'I64'] |
| 563 pass | |
| 564 | |
| 565 return platform in ['AMD64', 'I64'] | |
| 566 | 559 |
| 567 | 560 |
| 568 def IsLinuxHost(): | 561 def IsLinuxHost(): |
| 569 """Checks whether or not the script is running on Linux. | 562 """Checks whether or not the script is running on Linux.""" |
| 570 | |
| 571 Returns: | |
| 572 True if running on Linux. | |
| 573 """ | |
| 574 return sys.platform.startswith('linux') | 563 return sys.platform.startswith('linux') |
| 575 | 564 |
| 576 | 565 |
| 577 def IsMacHost(): | 566 def IsMacHost(): |
| 578 """Checks whether or not the script is running on Mac. | 567 """Checks whether or not the script is running on Mac.""" |
| 579 | |
| 580 Returns: | |
| 581 True if running on Mac. | |
| 582 """ | |
| 583 return sys.platform.startswith('darwin') | 568 return sys.platform.startswith('darwin') |
| OLD | NEW |