Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Side by Side Diff: tools/auto_bisect/bisect_utils.py

Issue 548233002: Add a module to fetch builds from different types of builders. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated comments Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 proc = subprocess.Popen(command, shell=shell, stdout=subprocess.PIPE) 501 proc = subprocess.Popen(command, shell=shell, stdout=subprocess.PIPE)
502 (output, _) = proc.communicate() 502 (output, _) = proc.communicate()
503 503
504 if cwd: 504 if cwd:
505 os.chdir(original_cwd) 505 os.chdir(original_cwd)
506 506
507 return (output, proc.returncode) 507 return (output, proc.returncode)
508 508
509 509
510 def IsStringInt(string_to_check): 510 def IsStringInt(string_to_check):
511 """Checks whether or not the given string can be converted to a integer. 511 """Checks whether or not the given string can be converted to an int."""
512
513 Args:
514 string_to_check: Input string to check if it can be converted to an int.
515
516 Returns:
517 True if the string can be converted to an int.
518 """
519 try: 512 try:
520 int(string_to_check) 513 int(string_to_check)
521 return True 514 return True
522 except ValueError: 515 except ValueError:
523 return False 516 return False
524 517
525 518
526 def IsStringFloat(string_to_check): 519 def IsStringFloat(string_to_check):
527 """Checks whether or not the given string can be converted to a floating 520 """Checks whether or not the given string can be converted to a float."""
528 point number.
529
530 Args:
531 string_to_check: Input string to check if it can be converted to a float.
532
533 Returns:
534 True if the string can be converted to a float.
535 """
536 try: 521 try:
537 float(string_to_check) 522 float(string_to_check)
538 return True 523 return True
539 except ValueError: 524 except ValueError:
540 return False 525 return False
541 526
542 527
543 def IsWindowsHost(): 528 def IsWindowsHost():
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') 529 return sys.platform == 'cygwin' or sys.platform.startswith('win')
550 530
551 531
552 def Is64BitWindows(): 532 def Is64BitWindows():
553 """Returns whether or not Windows is a 64-bit version. 533 """Chhecks whether or not Windows is a 64-bit version."""
ghost stip (do not use) 2014/09/17 00:12:07 nit: Checks
qyearsley 2014/09/18 22:58:58 Done.
554 534 platform = os.environ.get('PROCESSOR_ARCHITEW6432')
555 Returns: 535 if not platform:
556 True if Windows is 64-bit, False if 32-bit. 536 # Must not be running in WoW64, so PROCESSOR_ARCHITECTURE is correct.
557 """ 537 platform = os.environ.get('PROCESSOR_ARCHITECTURE')
558 platform = os.environ['PROCESSOR_ARCHITECTURE'] 538 return platform and platform in ['AMD64', 'I64']
559 try:
560 platform = os.environ['PROCESSOR_ARCHITEW6432']
561 except KeyError:
562 # Must not be running in WoW64, so PROCESSOR_ARCHITECTURE is correct
563 pass
564
565 return platform in ['AMD64', 'I64']
566 539
567 540
568 def IsLinuxHost(): 541 def IsLinuxHost():
569 """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') 542 return sys.platform.startswith('linux')
575 543
576 544
577 def IsMacHost(): 545 def IsMacHost():
578 """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') 546 return sys.platform.startswith('darwin')
OLDNEW
« no previous file with comments | « no previous file | tools/auto_bisect/cloud_storage_wrapper.py » ('j') | tools/auto_bisect/cloud_storage_wrapper.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698